116 lines
5.9 KiB
Plaintext
116 lines
5.9 KiB
Plaintext
<!-- fq -->
|
||
<% is_student = is_cur_course_student? @bid.courses.first %>
|
||
<% is_teacher = is_course_teacher User.current,@bid.courses.first %>
|
||
<!-- 当is_evaluation为1或者null(null主要是为了兼容前面数据)时代表启用互评功能,2表示未启用 -->
|
||
<% is_evaluation = @bid.is_evaluation == 1 || @bid.is_evaluation == nil %>
|
||
|
||
<%= form_tag(:controller => 'bids', :action => "show_project", :method => :get) do %>
|
||
<div class="project-search-block">
|
||
<table width="100%" valign="center">
|
||
<tr>
|
||
<td ><span style="margin-left:0px"><%= l(:label_task_plural)%>(<%= @homework_list.count%>)</span>
|
||
<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(
|
||
User.current.admin? ||
|
||
!(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) ||
|
||
(Rails.env.development?) %>
|
||
</td>
|
||
<td align="right">
|
||
<div class="project-search">
|
||
<% if is_teacher %>
|
||
<%= text_field_tag 'student_id', params[:student_id], :size => 30 %>
|
||
<%= submit_tag l(:label_search_by_student_id), :class => "small", :name => nil %>
|
||
<% end %>
|
||
</div></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<% end %>
|
||
<% display_id = im_watching_student_id? @bid%>
|
||
<% @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">
|
||
<tr>
|
||
<td style="width: 300px;">
|
||
<strong>作业 :</strong>
|
||
<% 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 %>
|
||
<!--
|
||
<% if attachments.count > 1 && attachment != attachments.first %>
|
||
<br/>
|
||
<% for item in 1..7 %>
|
||
|
||
<% end %>
|
||
<% end %>
|
||
-->
|
||
<% end %>
|
||
<% else %>
|
||
<% homework_filename = homework.name %>
|
||
<% end %>
|
||
<strong>
|
||
<% if is_evaluation || is_teacher%>
|
||
<%= link_to homework_filename, :controller => "zipdown", :action => "download_user_homework",:obj_class => @bid.class,:obj_id => @bid, :user_id =>homework.user%>
|
||
<% 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>
|
||
</tr>
|
||
<tr>
|
||
<td colspan="1" valign="top" style="width: 300px">
|
||
<strong>发布人: <%= 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_i ) %>
|
||
</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">
|
||
<% if User.current.member_of?(@bid.courses.first) %>
|
||
<strong><%= l(:label_bidding_user_studentcode) %> : <%= homework.user.student_id%></strong>
|
||
<% end %>
|
||
</td>
|
||
<td>
|
||
<% if (User.current == homework.user) || (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? &&
|
||
(Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',3,7, 9)).size >0) %>
|
||
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
|
||
<%= link_to(l(:label_bid_respond_delete), homework,
|
||
method: :delete, :confirm => l(:text_are_you_sure)) %>
|
||
<% end %>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<div class="line_under"></div>
|
||
<% end %>
|