<% is_teacher = User.current.allowed_to?(:as_teacher,homework_common.course) %>
<%=link_to image_tag(url_to_avatar(homework_common.user),width:"50px", height: "50px"), user_activities_path(homework_common.user.id)%>
<%= 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"%>
<% if homework_common.homework_detail_manual%> <% if homework_common.homework_detail_manual.comment_status == 0 %> 未发布 <% elsif homework_common.homework_detail_manual.comment_status == 1%> <% if homework_common.anonymous_comment == 0%> 未开启匿评 <% else %> 匿评已禁用 <% end %> <% if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%> 作品提交中 <% elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %> 作品补交中 <% end %> <% elsif homework_common.homework_detail_manual.comment_status == 2%> <% if homework_common.anonymous_comment == 0%> 匿评中 <% else %> 匿评已禁用 <% end %> 教师评阅中 <% elsif homework_common.homework_detail_manual.comment_status == 3%> <% if homework_common.anonymous_comment == 0%> 匿评已结束 <% else %> 匿评已禁用 <% end %> 教师评阅中 <% end%> <% end%>
<% if homework_common.homework_type == 3%> 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! <% end %>
<% if homework_common.homework_type == 3 && !is_teacher && homework_common.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(homework_common.course) %> <% projects = cur_user_projects_for_homework homework_common %> <% works = cur_user_works_for_homework homework_common %> <% if works.nil? && projects.nil? %>
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目' %> <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
<% elsif works.nil? %>
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
<% end %> <% end %>
<%= user_for_homework_common homework_common,is_teacher %>
<% if homework_common.homework_type == 2 && is_teacher%>
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
<% end %> <% if homework_common.homework_type == 2%>
语言: <%= homework_common.language_name%>
<% end %>
<%= l(:label_end_time)%>:<%= homework_common.end_time%> 23:59
<% if homework_common.homework_detail_manual.comment_status == 0 %>
<%= l(:label_publish_time)%>:<%= homework_common.publish_time%> 00:00
<% end %>
<%= homework_common.description.html_safe %>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
<% if homework_common.homework_type == 3 && !homework_common.student_work_projects.empty? && homework_common.homework_detail_group.base_on_project == 1 %>
已关联项目:
<% homework_common.student_work_projects.where("is_leader = 1").each do |pro| %> <% project = Project.find pro.project_id %>
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %> <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s,:alt =>"项目头像" %> <% else %> <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s,:alt =>"项目头像") %> <% end %>
项目名称:<%=project.name %>
创建者:<%=(User.find project.user_id).show_name %>
<% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> 更新时间:<%=time_from_now time %>
<% end %>
<% end %>
<% if is_teacher%> <% comment_status = homework_common.homework_detail_manual.comment_status%>
    • <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%>
    • <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
    • <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %>
    • <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
    • <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true)%>
    • <% end %> <% if homework_common.anonymous_comment == 0%>
    • <%= homework_anonymous_comment(homework_common, is_in_course) %>
    • <% end %> <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
    • <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%>
    • <% end %>
<% end%>
<% count=homework_common.journals_for_messages.count %>
回复(<%= count %>)
<%if count>3 %> <% end %>
<% replies_all_i = 0 %> <% if count > 0 %>
    <% homework_common.journals_for_messages.reorder("created_on desc").each do |comment| %> <% replies_all_i = replies_all_i + 1 %>
  • <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
    <% if comment.try(:user).try(:realname) == ' ' %> <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <% else %> <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %>
    <%= comment.notes.html_safe %>
  • <% end %>
<% end %>
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => homework_common.id},:method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'homework_common_id',params[:homework_common_id],:value =>homework_common.id %> <%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %>

<% end%>