<% if is_student_batch_homework %>
<%= image_tag(url_to_avatar("匿名"), :width => "40", :height => "40")%>
匿名
<% else %>
<%= link_to image_tag(url_to_avatar(homework.user), :width => "40", :height => "40"), user_path(homework.user) %>
<% user_realname = homework.user.lastname.to_s + homework.user.firstname.to_s %>
<% user_name = is_teacher ? (user_realname.empty? ? homework.user.login : user_realname) : homework.user.login %>
<%= link_to user_name, user_path(homework.user), :title => user_name %>
<% end %>
<% if homework.name == nil || homework.name == "" %>
<% homework_filename = homework.user.name + "提交的作业" %>
<% else %>
<% homework_filename = homework.name %>
<% end %>
<%= link_to homework_filename , homework_attach_path(homework), :title => homework_filename, :remote => true%>
<%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%>
<%= l(:label_teacher_score)%>:
<%= homework.t_score.nil? ? l(:label_without_score) : format("%.2f",homework.t_score)%>
<%= l(:label_student_score)%>:
<%= homework.s_score.nil? ? l(:label_without_score) : format("%.2f",homework.s_score) %>
<% if is_teacher %>
<%= link_to l(:label_work_rating),homework_attach_path(homework),:remote => true %>
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
迟交!
<% end %>
<% else %>
<% if is_my_homework %>
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
<% if homework.user == User.current || User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), homework,
method: :delete, :confirm => l(:text_are_you_sure), :remote => true ) %>
<% else %>
<%= link_to l(:label_logout), destory_homework_users_homework_attach_path(homework,:user_id=>User.current.id),
:remote => true, :confirm => l(:label_sure_exit_homework) %>
<% end %>
<% elsif is_student_batch_homework%>
<% if @bid.comment_status == 1 %>
<%= link_to l(:label_work_rating),homework_attach_path(homework),:remote => true %>
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
迟交!
<% end %>
<% elsif @bid.comment_status == 2%>
评分
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
迟交!
<% end %>
<% end %>
<% else %>
<%= render :partial => "homework_attach/homework_praise", locals: {:homework => homework} %>
<% end %>
<% end %>