<% 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,:cur_page => @cur_page,:cur_type => @cur_type), :title => homework_filename, :remote => true%>
<%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%>
<% unless is_student_batch_homework %>
<%= l(:label_teacher_score)%>:
<%= homework.t_score.nil? ? l(:label_without_score) : format("%.2f",homework.t_score)%>
<% end %>
<%= is_student_batch_homework ? l(:label_my_score) : l(:label_student_score)%>:
<%= is_student_batch_homework ? (homework.m_score.nil? ? l(:label_without_score) : format("%.2f",homework.m_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,:cur_page => @cur_page,:cur_type => @cur_type),: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 %>
<% if @bid.comment_status == 0 %>
<%= 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 %>
<% else %>
<%= l(:button_edit) %>
<% if homework.user == User.current || User.current.admin? %>
<%=l(:label_bid_respond_delete)%>
<% else %>
<%=l(:label_logout) %>
<% end %>
<% end %>
<% elsif is_student_batch_homework%>
<% if @bid.comment_status == 1 %>
<%= link_to l(:label_anonymous_comments),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),: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%>
<%= l(:label_anonymous_comments) %>
<% 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 %>