作业动态添加作品评阅和作品提交消息

This commit is contained in:
cxt 2016-01-05 11:29:30 +08:00
parent 3ddbeae100
commit f52dc37a76
5 changed files with 151 additions and 5 deletions

View File

@ -180,7 +180,7 @@ module ApiHelper
if timePassed < 0
updateAtValue = "时间有问题"
elsif timePassed < ONE_MINUTE
updateAtValue = "分钟前"
updateAtValue = "1分钟前"
elsif timePassed < ONE_HOUR
timeIntoFormat = timePassed / ONE_MINUTE
updateAtValue = timeIntoFormat.to_s + "分钟前"

View File

@ -44,7 +44,27 @@
<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>
<% end%>
<% end%>
<div class="cl"></div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>
<div class="homepagePostSubmitContainer">
<% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%>
<% projects = cur_user_projects_for_homework activity %>
<% works = cur_user_works_for_homework activity %>
<% if works.nil? && projects.nil? %>
<div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
</div>
<% elsif works.nil? %>
<div class="homepagePostSubmit">
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
</div>
<% end %>
<% end %>
<div class="homepagePostSubmit">
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
@ -61,8 +81,16 @@
<%= activity.language_name%>
</div>
<% end %>
<div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %>&nbsp;23:59</div>
<% if activity.homework_type == 3 && activity.homework_detail_group%>
<div class="homepagePostDeadline mr15">
分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
</div>
<% end %>
<% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %>
<div class="homepagePostDeadline">提交截止时间:<%= activity.end_time.to_s %>&nbsp;23:59</div>
<% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 %>
<div class="homepagePostDeadline">匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %>&nbsp;23:59</div>
<% end %>
</div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>">
@ -73,10 +101,88 @@
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<div class="mt10">
<div class="homepagePostDeadline">
迟交扣分:<%= activity.late_penalty%>分
</div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_start_time_<%=user_activity_id %>">
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00
</div>
<% end %>
</div>
<div class="cl"></div>
<div>
<div class="homepagePostDeadline">
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
</div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div>
<% end %>
</div>
<div class="cl"></div>
<% if activity.student_works.count != 0 %>
<% sw = activity.student_works.reorder("created_at desc").first %>
<div class="mt10 homepagePostDeadline">
<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
<% end %>
<div class="cl"></div>
<% if activity.student_works.count != 0 %>
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
<% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
<div class="mt5 homepagePostDeadline">
<%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品
</div>
<% end %>
<% end %>
<div class="cl"></div>
<div>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
<div class="cl"></div>
</div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<div class="mt10">
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<div class="fl mr5 fontGrey3">
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
</div>
<% projects.each do |pro| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>_<%=activity.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","none");
});
});
</script>
<div class="mr20 mb10 fl w80" style="text-align: center;">
<% 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+"_"+activity.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
<% end %>
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p><span class="captainName"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %></p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now time %>
</div>
</div>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if is_teacher%>
<% comment_status = activity.homework_detail_manual.comment_status %>
<div class="homepagePostSetting">

View File

@ -124,6 +124,24 @@
<% end %>
</div>
<div class="cl"></div>
<% if activity.student_works.count != 0 %>
<% sw = activity.student_works.reorder("created_at desc").first %>
<div class="mt10 homepagePostDeadline">
<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
<% end %>
<div class="cl"></div>
<% if activity.student_works.count != 0 %>
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
<% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
<div class="mt5 homepagePostDeadline">
<%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品
</div>
<% end %>
<% end %>
<div class="cl"></div>
<div>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
<div class="cl"></div>
@ -131,7 +149,7 @@
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<div class="mt10">
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<div class="mb10 mr5 fontGrey3">
<div class="fl mr5 fontGrey3">
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
</div>
<% projects.each do |pro| %>

View File

@ -127,6 +127,24 @@
<% end %>
</div>
<div class="cl"></div>
<% if homework_common.student_works.count != 0 %>
<% sw = homework_common.student_works.reorder("created_at desc").first %>
<div class="mt10 homepagePostDeadline">
<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
<% end %>
<div class="cl"></div>
<% if homework_common.student_works.count != 0 %>
<% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %>
<% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
<div class="mt5 homepagePostDeadline">
<%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品
</div>
<% end %>
<% end %>
<div class="cl"></div>
<div>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
<div class="cl"></div>

View File

@ -103,4 +103,8 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
.sectionContent span {width:175px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:18px; vertical-align:middle;}.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px;
background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
.org_login_list a {color:#269ac9;}
div.flash {margin-top :0px !important}
div.flash {margin-top :0px !important}
.w80{ width:80px;}
.relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;}
.captainName {max-width:40px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}