<% bid = homework.bid%>
<li class="pic_head" style="line-height: 1.2;">
  <% if is_student_batch_homework %>
    <!-- 学生匿评 不现实姓名、头像，以及相关的连接 -->
      <a><%= image_tag(url_to_avatar("匿名"), :width => "40", :height => "40")%></a>
      <a>匿名</a>
  <% else %>
      <%= link_to image_tag(url_to_avatar(homework.user), :width => "40", :height => "40"), user_path(homework.user) %>
      <span>
        <% 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 %>
      </span>
  <% end %>
</li>
<li class="wname">
  <% 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,:cur_sort => @cur_sort, :cur_direction => @cur_direction), :title => homework_filename, :remote => true%>
  <span class="c_grey ">
    提交时间：
    <%= format_time homework.created_at%>
  </span>
</li>
<li class="wdown">
  <%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%>
</li>
<li class="wscore">
  <% unless is_student_batch_homework %>
      <%= l(:label_teacher_score)%>:
      <span class="c_red">
        <%= (homework.t_score.nil?) ? l(:label_without_score) : format("%.2f",homework.t_score)%>
      </span>
      &nbsp;&nbsp;
  <% end %>
</li>
<li class="wscore">
  <%= is_student_batch_homework ? l(:label_my_score) : l(:label_student_score)%>:
  <span class="c_red">
    <%= 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))%>
  </span>
</li>
<% if is_teacher %>
    <!-- 是老师，所有列表正常显示 -->
    <li class="wping">
      <%= link_to l(:label_work_rating),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type,:cur_sort => @cur_sort, :cur_direction => @cur_direction),:remote => true  %>
      <% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
          <span class="c_red">&nbsp;&nbsp;迟交！</span>
      <% end %>
    </li>
<% else %>
    <!-- 是学生 -->
    <% if is_my_homework %>
        <!-- 我的作品，在未开启匿评和未使用匿评，显示为编辑和删除 -->
        <% if bid.comment_status == 0 || bid.open_anonymous_evaluation == 0 || bid.comment_status == 2 %>
            <li class="wmine">
              <%= 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 %>
            </li>
        <% else %>
            <li class="wmine" title="已开启匿评的作业不能进行修改和删除">
              <a style="color:#8e8e8e;"><%= l(:button_edit) %></a>
              <%  if homework.user == User.current || User.current.admin? %>
                  <!-- 作业创建者显示删除作业 -->
                  <a style="color:#8e8e8e;">
                    <%=l(:label_bid_respond_delete)%>
                  </a>
              <% else %>
                  <!-- 作业参与者显示退出作业 -->
                  <a style="color:#8e8e8e;">
                    <%=l(:label_logout) %>
                  </a>
              <% end %>
            </li>
        <% end %>
    <% elsif is_student_batch_homework%>
        <!-- 学生匿评列表 -->
        <% if bid.comment_status == 1 %>
            <!-- 处于开启匿评阶段，可以正常评分 -->
            <li class="wping">
              <%= 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") %>
                  <span class="c_red">&nbsp;&nbsp;迟交！</span>
              <% end %>
            </li>
        <% elsif bid.comment_status == 2%>
            <!-- 处于匿评已关闭阶段,不容许评分 -->
            <li class="wping" title="关闭匿评后不可继续评分">
              <a style="background:#8e8e8e;">
                <%= l(:label_anonymous_comments) %>
              </a>
              <% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
                  <span class="c_red">&nbsp;&nbsp;迟交！</span>
              <% end %>
            </li>
        <% end %>
    <% else %>
        <!-- 学生众评列表，显示为点赞 -->
        <li class="wzan" id="homeworl_praise_li_<%= homework.id%>">
          <%= render :partial => "homework_attach/homework_praise", locals: {:homework => homework}  %>
        </li>
    <% end %>
<% end %>