<% can_edit_flag = User.current.allowed_to?(:as_teacher,item) || User.current.admin? %>
<% course_end_flag = course_endTime_timeout?(item) %>
<div class="courses_list line" id="nh_course_<%=item.id%>">
  <div class="courses_list_pic fl">
    <a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>item.id, :host=>Setting.host_course) %>" title="<%= item.name %>">
      <%= image_tag(url_to_avatar(item), :style => 'width:64px;height:64px;') %>
    </a>
  </div>
  <div class="courses_list_info fl ml10">
    <a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>item.id, :host=>Setting.host_course) %>" title="<%= item.name %>" class="courses_list_title  f14 fb <%=course_end_flag ? 'c_dark' : 'c_blue02'%> fl"><%= item.name %></a>
    <% if(can_edit_flag) %>
      <% if(course_end_flag) %>
        <a href="<%=restartcourse_course_path(item)%>" class="pic_eye_grey fl ml5" title="重开课程" data-confirm="确定要重开课程？" data-method="post" data-remote="true"></a>
      <% else %>
        <a href="<%=finishcourse_course_path(item, format: :js)%>" class="pic_eye_blue fl ml5" title="关闭课程" data-confirm="确定要关闭课程？" data-method="post" data-remote="true"></a>
      <% end %>
    <% end %>
    <div class="cl"></div>
    <div class="courses_list_table">
      <table><tbody>
      <tr>
        <td class="td_w60 ">主讲老师：</td>
        <td class="td_w70 ">
          <a href="<%= user_path(item.teacher) %>" title="<%= item.teacher.show_name %>"><%= item.teacher.show_name %></a>
        </td>
        <td class="td_w60 ">课程作业：</td>
        <td class="td_w110 "><a href="<%=url_for(:controller => 'homework_common', :action => 'index',:course=>item.id, :host=>Setting.host_course)%>"><%= item.homework_commons.count %></a></td>
      </tr>
      <tr>
        <td>学生人数：</td>
        <td><a href="<%= url_for(:controller => 'courses', :action=>"member", :id=>item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %></a></td>
        <td>开课学期：</td>
        <td>
          <%= item.time %>
          <%= get_course_term_locales item %>
        </td>
      </tr>
      </tbody></table>
    </div>
  </div>
  <% if(course_end_flag) %>
    <span class="grey_n_btn fr mt20">课程结束</span>
  <% elsif(can_edit_flag) %>
    <a href="<%=url_for(:controller => 'homework_common', :action => 'new',:course=>item.id, :host=>Setting.host_course)%>" target="_blank" class="blue_n_btn fr mt20">发布作业</a>
  <% elsif User.current.member_of_course? item %>
    <a href="<%=url_for(:controller => 'homework_common', :action => 'index',:course=>item.id, :host=>Setting.host_course)%>" target="_blank" class="blue_n_btn fr mt20">提交作品</a>
  <% elsif User.current.logged?%>
    <%= link_to "加入课程",try_join_path(:object_id => item.id), :class => "blue_n_btn fr mt20", :remote => "true",:id => "try_join_course_link"%>
  <% end %>
  <div class="cl"></div>
</div>