<% homework_commons.each do |homework_common|%>
    <% is_teacher = User.current.allowed_to?(:as_teacher,homework_common.course) %>
    <div class="HomeWork mb10">
      <div class="homepagePostBrief">
        <div class="homepagePostPortrait">
          <%=link_to image_tag(url_to_avatar(homework_common.user),width:"50px", height: "50px"), user_activities_path(homework_common.user.id)%>
        </div>
        <div class="homepagePostDes">
          <div class="homepagePostTo">
            <%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%>
            TO
            <%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%>
          </div>
          <span class="homepagePostTitle hidden m_w530 fl">
            <%= link_to homework_common.name,student_work_index_path(:homework => homework_common.id),:class => "postGrey"%>
          </span>

          <% if homework_common.homework_detail_manual%>
            <% if homework_common.homework_detail_manual.comment_status == 1%>
              <span class="grey_btn_cir ml10">未开启匿评</span>
            <% elsif homework_common.homework_detail_manual.comment_status == 2%>
              <span class="green_btn_cir ml10">匿评中</span>
            <% elsif homework_common.homework_detail_manual.comment_status == 3%>
              <span class="grey_btn_cir ml10">匿评已结束</span>
            <% end%>
          <% end%>

          <div class="homepagePostSubmitContainer">
            <div class="homepagePostSubmit">
              <%= user_for_homework_common homework_common,is_teacher %>
            </div>
            <% if homework_common.homework_type == 2 && is_teacher%>
                <div class="homepagePostSubmit">
                  <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
                </div>
            <% end %>
            <% if homework_common.homework_type == 2%>
                <div class="homepagePostDeadline mr15">
                    语言：
                    <%= homework_common.language_name%>
                </div>
            <% end %>
            <div class="homepagePostDeadline">
              <%= l(:label_end_time)%>：<%= homework_common.end_time%>
            </div>
          </div>
          <div class="homepagePostIntro upload_img break_word list_style">
            <%= homework_common.description.html_safe %>
          </div>
          <div class="mt10">
            <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
            <div class="cl"></div>
          </div>
          <% if is_teacher%>
          <%# if false%>
              <div class="homepagePostSetting">
                <ul>
                  <li class="homepagePostSettingIcon">
                    <ul class="homepagePostSettiongText">
                      <li>
                        <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course), :class => "postOptionLink"%>
                      </li>
                      <li>
                        <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink")  %>
                      </li>
                      <li>
                        <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) if homework_common.homework_detail_manual.comment_status == 1%>
                      </li>
                      <li>
                        <%= homework_anonymous_comment homework_common %>
                      </li>
                    </ul>
                  </li>
                </ul>
              </div>
          <% end%>
        </div>
        <div class="cl"></div>
      </div>
    </div><!----HomeWork end-->
<% end%>
<% if homework_commons.count == 10%>
    <% if is_in_course == 1%>
        <!-- 在课程内 -->
        <%= link_to "加载更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
    <% else%>
        <!-- 在个人主页 -->
        <%= link_to "加载更多",user_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
    <% end%>
<% end%>