<% homeworks.each do |homework| %>
<%= homework.name%>
<% if homework.course.is_public == 0 %>
<% end %>
<%=homework.course.name %>(<%=current_time_and_term_short(homework.course) %>)
<% case homework.homework_type %> <% when 1 %> 普通 <% when 2 %> 编程 <% when 3 %> 分组 <% end %>
<%= homework.user.show_name %>
<%= homework.quotes %>
<%=format_date homework.publish_time %>
<% if homework.course.is_public == 0 && homework.user_id != User.current.id %>
<% ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, homework.id).first %> <% if ah.nil? %> <%= link_to("提交申请", apply_for_homework_user_path(User.current.id,:homework_id => homework.id), :remote => true) %> <% elsif ah.status == 1 %> 待审核 <% elsif ah.status == 2 %> 可引用 <% elsif ah.status == 3 %> 已拒绝 <% end %>
<% else %>
--
<% end %>
<% end %>