<%= 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 %>
<% 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 ) %>
<% end %>
<% elsif is_student_batch_homework%>
<%= 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_praise_homework User.current.id,homework.id %>
<%= link_to "",praise_homework_homework_attach_path(homework,:is_my_homework => is_my_homework,
:is_student_batch_homework => is_student_batch_homework,
:is_teacher => is_teacher),
:class => "wzan_img wzan_visited", :remote => true%>
<%= praise_homework_count homework.id %>
<% else %>
<%= praise_homework_count homework.id %>
<% end %>
<% end %>
<% end %>