作业显示界面页面改造,实现新的页面显示效果

This commit is contained in:
sw 2014-06-19 13:51:39 +08:00
parent 2f66296b62
commit 71bb76ff91
1 changed files with 84 additions and 54 deletions

View File

@ -28,67 +28,19 @@
<% @homework_list.each do |homework|%>
<table width="660px" border="0" align="center" id="homework_attach_<%= homework.id %>" >
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
<td>
<table width="580px" border="0">
<td style="vertical-align: top;width: 70px" >
<table style="text-align: center;width: 100%;table-layout: fixed">
<tr>
<td style="width: 300px;">
&nbsp;&nbsp;<strong>作业&nbsp;&nbsp; :</strong>&nbsp;
<% if homework.name == nil || homework.name == "" %>
<% attachments = homework.attachments.map %>
<% for attachment in attachments %>
<% if attachments.count > 1 %>
<% homework_filename = attachment.filename + "等" + attachments.count.to_s + "个文件" %>
<% else %>
<% homework_filename = attachment.filename %>
<% end %>
<% end %>
<% else %>
<% homework_filename = homework.name %>
<% end %>
<strong>
<% if is_evaluation || is_teacher%>
<%= link_to homework_filename, :controller => "zipdown", :action => "download_user_homework",:homework => homework%>
<% else %>
<%= homework_filename %>
<% end %>
</strong>
</td>
<td style="vertical-align: top">
<% if is_student %>
<% if is_evaluation %>
<%= link_to "互评>>" , homework_attach_path(homework)%>
<% else %>
<%= link_to "查看详细" , homework_attach_path(homework)%>
<% end %>
<% else %>
<% if is_teacher %>
<%= link_to "综评>>" , homework_attach_path(homework)%>
<% end %>
<% end %>
<td title="<%= homework.user.name %>"><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>
</tr>
<tr>
<td title="<%= homework.user.name %>">
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><strong>
<%= link_to (is_teacher ? homework.user.realname : homework.user ), user_path(homework.user)%>
</strong></p>
</td>
</tr>
<tr>
<td colspan="1" valign="top" style="width: 300px">&nbsp;
<strong>发布人:&nbsp; <%= link_to ( is_teacher ? homework.user.realname : homework.user ), user_path(homework.user)%></strong>
</td>
<td>
<strong>作业评分:</strong>
<%= format("%.2f", homework.rate_averages.first.try(:avg).to_f ) %>
</td>
<td valign="top" align="right">
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.created_at.to_s) %>
<span class="required">迟交</span>
<% end %>
</td>
</tr>
<tr>
<td valign="top">&nbsp;
<% if User.current.member_of?(@bid.courses.first) %>
<strong><%= l(:label_bidding_user_studentcode) %>&nbsp; &nbsp;<%= homework.user.student_id%></strong>
<% end %>
</td>
<td>
<% if (users_for_homework(homework).include?(User.current) || is_teacher) %>
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
@ -100,6 +52,84 @@
</td>
</tr>
</table>
<span></span>
</td>
<td colspan="2">
<table width="580px" border="0" style="table-layout: fixed">
<tr>
<td style="width: 300px;">
<strong>作业名称:</strong>&nbsp;
<% if homework.name == nil || homework.name == "" %>
<% homework_filename = homework.user.name + "提交的作业" %>
<% else %>
<% homework_filename = homework.name %>
<% end %>
<strong>
<%= link_to homework_filename , homework_attach_path(homework)%>
</strong>
</td>
<td style="vertical-align: top;width: 200px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<strong>参与人员:&nbsp;</strong>
<% homework_users = "" %>
<% homework.users.each do |user| %>
<% homework_users = user.name %>
<% end %>
<% if homework.users.count == 0 %>
<% else %>
<%= homework_users %>
<% end %>
</td>
<td rowspan="4" style="text-align: center;vertical-align: middle;width: 30px">
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.created_at.to_s) %>
<span class="required">迟交</span>
<% end %>
</td>
</tr>
<tr>
<td>
<strong>开发项目:</strong>&nbsp;
<% if homework.project != nil %>
<%= link_to homework.project.name,project_path(homework.project.id)%>
<% else %>
该作业暂无项目
<% end %>
</td>
<td>
<strong>项目得分:</strong>&nbsp;
<% if homework.project != nil %>
0分
<% else %>
0分
<% end %>
</td>
</tr>
<tr>
<td>
<strong>提交文件:&nbsp;
<%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework%>
</strong>
</td>
<td>
<strong>互评得分:&nbsp;
<span class="required"><%= format("%.2f", homework.rate_averages.first.try(:avg).to_f ) %></span>&nbsp;&nbsp;
<%= link_to "学生互评>>",homework_attach_path(homework) %></strong>
</td>
</tr>
<tr>
<td>
</td>
<td>
<strong>综评得分:&nbsp;
<span class="required"><%= format("%.2f", homework.rate_averages.first.try(:avg).to_f ) %></span>&nbsp;&nbsp;
<%= link_to "教师评分>>",homework_attach_path(homework) %></strong>
</td>
</tr>
</table>
</td>
</tr>
</table>