作业动态显示优秀作品、关联项目的样式修改

This commit is contained in:
cxt 2016-01-18 10:13:31 +08:00
parent 902cfdcbe9
commit 020135cbc2
9 changed files with 265 additions and 139 deletions

View File

@ -2787,13 +2787,6 @@ int main(int argc, char** argv){
ss.html_safe ss.html_safe
end end
#代码提交数量
def changesets_num project
g = Gitlab.client
project.gpid.nil? ? 0 : g.project(project.gpid).commit_count
# project.changesets.count
end
#课程动态的更新 #课程动态的更新
def update_course_activity type, id def update_course_activity type, id
course_activity = CourseActivity.where("course_act_type=? and course_act_id =?", type.to_s, id).first course_activity = CourseActivity.where("course_act_type=? and course_act_id =?", type.to_s, id).first
@ -2834,4 +2827,13 @@ int main(int argc, char** argv){
principal_activity.save principal_activity.save
end end
end end
#项目按更新时间排序
def project_sort_update projects
unless projects.empty?
project_ids = '('+projects.map{|pro|pro.project_id}.join(',')+')'
sort_projects = ForgeActivity.find_by_sql("SELECT MAX(updated_at) AS updated_at,user_id, project_id FROM forge_activities WHERE project_id IN #{project_ids} GROUP BY project_id ORDER BY MAX(updated_at) DESC")
return sort_projects
end
end
end end

View File

@ -130,59 +130,86 @@
<% if activity.student_works.count != 0 %> <% if activity.student_works.count != 0 %>
<% sw = activity.student_works.reorder("created_at desc").first %> <% sw = activity.student_works.reorder("created_at desc").first %>
<div class="mt10 homepagePostDeadline"> <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"%>提交了作品 #&nbsp;<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div> </div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% if activity.student_works.count != 0 %> <% if activity.student_works.count != 0 %>
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> <% 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") %> <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
<% unless student_work_scores.empty? %> <%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
<% last_score = student_work_scores.first %> <% unless student_work_scores.empty? %>
<div class="mt5 homepagePostDeadline"> <% last_score = student_work_scores.first %>
<%=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 class="mt10">
</div> <p class="mb10 fontGrey2">#&nbsp;<%=time_from_now last_score.created_at %>
<% end %> <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
<% end %> </p>
<% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
<% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score<0 ? 0 : score) %>分</span></p>
</div>
<% if i == 4 %>
<% break %>
<% end %>
<% end %>
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<div class="cl"></div> <div class="cl"></div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %> <% 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") %>
<% projects = activity.student_work_projects.where("is_leader = 1") %> <% unless projects.empty? %>
<div class="fl mr20 fontGrey3"> <% sort_projects = project_sort_update projects %>
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %> <div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
</div> <div class="mr5 fontGrey2">
<div class="cl"></div> #&nbsp;<%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
<% 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 mt10 fl w110 fontGrey3" 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" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</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> </div>
<% end %> <div class="cl"></div>
</div> <% sort_projects.each_with_index do |pro, i| %>
<% 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="mr10 mb10 mt10 fl w100 fontGrey2" 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 class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18"><%=time_from_now time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</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>
<% if i == 9 && projects.count > 10 %>
<a href="javascript:void(0);" class="linkGrey2 fl ml50" style="margin-top:68px;" id="moreProject_<%=user_activity_id %>">更多>></a>
<% end %>
<% if i > 9 && i == (projects.count - 1) %>
<a href="javascript:void(0);" class="linkGrey2 fr mr10" style="margin-top:68px;" id="hideProject_<%=user_activity_id %>">收回&lt;&lt;</a>
<% end %>
<% end %>
</div>
<% end %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% if is_teacher%> <% if is_teacher%>
@ -313,5 +340,14 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$("#moreProject_<%=user_activity_id %>").click(function(){
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
$(this).hide();
});
$("#hideProject_<%=user_activity_id %>").click(function(){
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
$("#moreProject_<%=user_activity_id %>").show();
});
$(description_show_hide(<%=user_activity_id %>)); $(description_show_hide(<%=user_activity_id %>));
</script> </script>

View File

@ -80,8 +80,8 @@
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>"); $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
<% end %> <% end %>
<% end %> <% end %>
$('#score_<%= work.id%>').peSlider({range: 'min'});
<% end %> <% end %>
$('#score_<%= work.id%>').peSlider({range: 'min'});
<% end %> <% end %>
}); });
</script> </script>

View File

@ -130,58 +130,86 @@
<% if activity.student_works.count != 0 %> <% if activity.student_works.count != 0 %>
<% sw = activity.student_works.reorder("created_at desc").first %> <% sw = activity.student_works.reorder("created_at desc").first %>
<div class="mt10 homepagePostDeadline"> <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"%>提交了作品 #&nbsp;<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div> </div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% if activity.student_works.count != 0 %> <% if activity.student_works.count != 0 %>
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> <% 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") %> <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
<%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
<% unless student_work_scores.empty? %> <% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %> <% last_score = student_work_scores.first %>
<div class="mt5 homepagePostDeadline"> <div class="mt10">
<%=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"%>评阅了作品 <p class="mb10 fontGrey2">#&nbsp;<%=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"%>评阅了作品,优秀排行:
</p>
<% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
<% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score<0 ? 0 : score) %>分</span></p>
</div>
<% if i == 4 %>
<% break %>
<% end %>
<% end %>
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
<div class="cl"></div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %> <% 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") %> <% projects = activity.student_work_projects.where("is_leader = 1") %>
<div class="fl mr20 fontGrey3"> <% unless projects.empty? %>
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %> <% sort_projects = project_sort_update projects %>
</div> <div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="cl"></div> <div class="mr5 fontGrey2">
<% projects.each do |pro| %> #&nbsp;<%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
<% project = Project.find pro.project_id %> </div>
<script type="text/javascript"> <div class="cl"></div>
$(document).ready(function(){ <% sort_projects.each_with_index do |pro, i| %>
$("#project_img_<%=project.id %>_<%=activity.id %>").mouseover(function(){ <% project = Project.find pro.project_id %>
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","block"); <script type="text/javascript">
}).mouseout(function(){ $(document).ready(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","none"); $("#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>
</script>
<div class="mr20 mb10 mt10 fl w110 fontGrey3" style="text-align: center;"> <div class="mr10 mb10 mt10 fl w100 fontGrey2" style="text-align: center;">
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %> <% 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 =>"项目头像" %> <%= 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 %> <% 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 =>"项目头像") %> <%= 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 class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18"><%=time_from_now time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</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>
<% if i == 9 && projects.count > 10 %>
<a href="javascript:void(0);" class="linkGrey2 fl ml50" style="margin-top:68px;" id="moreProject_<%=user_activity_id %>">更多>></a>
<% end %>
<% if i > 9 && i == (projects.count - 1) %>
<a href="javascript:void(0);" class="linkGrey2 fr mr10" style="margin-top:68px;" id="hideProject_<%=user_activity_id %>">收回&lt;&lt;</a>
<% end %>
<% end %> <% 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" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</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> </div>
<% end %> <% end %>
</div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% if is_teacher%> <% if is_teacher%>
@ -313,5 +341,14 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(description_show_hide(<%=user_activity_id %>)); $("#moreProject_<%=user_activity_id %>").click(function(){
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
$(this).hide();
});
$("#hideProject_<%=user_activity_id %>").click(function(){
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
$("#moreProject_<%=user_activity_id %>").show();
});
$(description_show_hide(<%=user_activity_id %>));
</script> </script>

View File

@ -132,59 +132,87 @@
<% if homework_common.student_works.count != 0 %> <% if homework_common.student_works.count != 0 %>
<% sw = homework_common.student_works.reorder("created_at desc").first %> <% sw = homework_common.student_works.reorder("created_at desc").first %>
<div class="mt10 homepagePostDeadline"> <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"%>提交了作品 #&nbsp;<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div> </div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% if homework_common.student_works.count != 0 %> <% if homework_common.student_works.count != 0 %>
<% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %> <% 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") %> <% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
<% unless student_work_scores.empty? %> <%# 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 %> <% last_score = student_work_scores.first %>
<div class="mt5 homepagePostDeadline"> <div class="mt10">
<%=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"%>评阅了作品 <p class="mb10 fontGrey2">#&nbsp;<%=time_from_now last_score.created_at %>
</div> <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
<% end %> </p>
<% end %> <% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<div class="cl"></div> <% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %> <% student_works.each_with_index do |sw, i| %>
<div class="mt10"> <div class="fl mr10 w100" style="text-align:center;">
<% projects = homework_common.student_work_projects.where("is_leader = 1") %> <a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => homework_common.id), :alt => "学生头像" %>
<div class="fl mr20 fontGrey3"> <p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => homework_common.id)%></p>
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %> </a>
</div> <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<div class="cl"></div> <p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score<0 ? 0 : score) %>分</span></p>
<% projects.each do |pro| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>_<%=homework_common.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>_<%=homework_common.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>_<%=homework_common.id %>").css("display","none");
});
});
</script>
<div class="mr20 mb10 mt10 fl w110 fontGrey3" 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+"_"+homework_common.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.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" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now time %>
</div> </div>
</div> <% if i == 4 %>
<% end %> <% break %>
</div> <% end %>
<% end %> <% end %>
<%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<div class="cl"></div>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
<% projects = homework_common.student_work_projects.where("is_leader = 1") %>
<% unless projects.empty? %>
<% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=homework_common.id %>">
<div class="mr5 fontGrey2">
#&nbsp;<%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
</div>
<div class="cl"></div>
<% sort_projects.each_with_index do |pro, i| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>_<%=homework_common.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>_<%=homework_common.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>_<%=homework_common.id %>").css("display","none");
});
});
</script>
<div class="mr10 mb10 mt10 fl w100 fontGrey2" 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+"_"+homework_common.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.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 class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18"><%=time_from_now time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now time %>
</div>
</div>
<% if i == 9 && projects.count > 10 %>
<a href="javascript:void(0);" class="linkGrey2 fl ml50" style="margin-top:68px;" id="moreProject_<%=homework_common.id %>">更多>></a>
<% end %>
<% if i > 9 && i == (projects.count - 1) %>
<a href="javascript:void(0);" class="linkGrey2 fr mr10" style="margin-top:68px;" id="hideProject_<%=homework_common.id %>">收回&lt;&lt;</a>
<% end %>
<% end %>
</div>
<% end %>
<% end %>
<div class="cl"></div> <div class="cl"></div>
<% if is_teacher%> <% if is_teacher%>
<% comment_status = homework_common.homework_detail_manual.comment_status%> <% comment_status = homework_common.homework_detail_manual.comment_status%>
@ -315,5 +343,14 @@
</div> </div>
</div><!----HomeWork end--> </div><!----HomeWork end-->
<script type="text/javascript"> <script type="text/javascript">
$("#moreProject_<%=homework_common.id %>").click(function(){
$("#relatePWrap_<%=homework_common.id %>").toggleClass('relatePWrap');
$("#relatePWrap_<%=homework_common.id %>").css("height","auto");
$(this).hide();
});
$("#hideProject_<%=homework_common.id %>").click(function(){
$("#relatePWrap_<%=homework_common.id %>").toggleClass('relatePWrap');
$("#moreProject_<%=homework_common.id %>").show();
});
$(homework_description_show_hide(<%=homework_common.id %>)); $(homework_description_show_hide(<%=homework_common.id %>));
</script> </script>

View File

@ -1366,6 +1366,7 @@ ActiveRecord::Schema.define(:version => 20160114131753) do
t.integer "changeset_num", :default => 0 t.integer "changeset_num", :default => 0
t.integer "board_message_num", :default => 0 t.integer "board_message_num", :default => 0
t.integer "board_num", :default => 0 t.integer "board_num", :default => 0
t.integer "act_num", :default => 0
t.integer "attach_num", :default => 0 t.integer "attach_num", :default => 0
end end

View File

@ -1221,7 +1221,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
.hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} .hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;}
.mr150 {margin-right:150px;} .mr150 {margin-right:150px;}
.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;} .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;} .captainName {max-width:75px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
/*上传资源弹窗*/ /*上传资源弹窗*/
.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} .resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}
@ -1257,3 +1257,6 @@ div.disable_link {background-color: #c1c1c1 !important;}
.fn {font-weight:normal} .fn {font-weight:normal}
.boutiqueP {position:absolute; left:0px; top:0px;} .boutiqueP {position:absolute; left:0px; top:0px;}
.mh18 {max-height: 18px;}
.relatePWrap{max-height: 210px;overflow:hidden;}

View File

@ -77,6 +77,7 @@ a.linkGrey6:hover {color:#ffffff !important;}
.ml36{ margin-left:36px; } .ml36{ margin-left:36px; }
.ml40{ margin-left:40px;} .ml40{ margin-left:40px;}
.ml45{ margin-left:45px;} .ml45{ margin-left:45px;}
.ml50{ margin-left: 50px;}
.ml55{ margin-left:55px;} .ml55{ margin-left:55px;}
.ml30{ margin-left:30px;} .ml30{ margin-left:30px;}
.ml60{ margin-left:60px;} .ml60{ margin-left:60px;}
@ -95,6 +96,7 @@ a.linkGrey6:hover {color:#ffffff !important;}
.mr20{ margin-right:20px;} .mr20{ margin-right:20px;}
.mr30{ margin-right:30px !important;} .mr30{ margin-right:30px !important;}
.mr40{ margin-right:40px !important;} .mr40{ margin-right:40px !important;}
.mr65 {margin-right: 65px;}
.mw20{ margin: 0 20px;} .mw20{ margin: 0 20px;}
.mt-20 {margin-top:-20px;} .mt-20 {margin-top:-20px;}
.mt-4 {margin-top: -4px;} .mt-4 {margin-top: -4px;}
@ -121,6 +123,7 @@ a.linkGrey6:hover {color:#ffffff !important;}
.w70{ width:70px;} .w70{ width:70px;}
.w80{ width:80px;} .w80{ width:80px;}
.w90{ width:90px;} .w90{ width:90px;}
.w100 {width: 100px;}
.w110{width:110px;} .w110{width:110px;}
.w210{ width:210px;} .w210{ width:210px;}
.w150{ width:150px;} .w150{ width:150px;}
@ -581,7 +584,7 @@ a.homepageImageNumber:hover {color:#269ac9;}
.homepageLeftMenuCourses {font-size:13px; border-bottom:1px solid #dddddd;} .homepageLeftMenuCourses {font-size:13px; border-bottom:1px solid #dddddd;}
.homepageLeftMenuCoursesLine {height:38px; line-height:38px; vertical-align:middle;} .homepageLeftMenuCoursesLine {height:38px; line-height:38px; vertical-align:middle;}
.homepageLeftMenuCoursesLine:hover {background-color:#269ac9;} .homepageLeftMenuCoursesLine:hover {background-color:#269ac9;}
a.coursesLineGrey {padding-left:25px; padding-right:25px; color:#808080; display:block;} a.coursesLineGrey {padding-left:25px; padding-right:25px; color:#808080; display:block;}
a.coursesLineGrey:hover {color:#ffffff;} a.coursesLineGrey:hover {color:#ffffff;}
.homepageLeftMenuMore {height:18px;} .homepageLeftMenuMore {height:18px;}
.homepageLeftMenuMore:hover {background-color:#269ac9;} .homepageLeftMenuMore:hover {background-color:#269ac9;}
@ -1416,3 +1419,4 @@ span.at a{color:#269ac9;text-decoration: none;}
.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;} .orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;}
.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} .orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;}
.relatePWrap{max-height: 210px;overflow:hidden;}

View File

@ -71,6 +71,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.ml40{ margin-left:40px;} .ml40{ margin-left:40px;}
.ml45{ margin-left:45px;} .ml45{ margin-left:45px;}
.ml48{ margin-left:48px;} .ml48{ margin-left:48px;}
.ml50{ margin-left: 50px;}
.ml53{margin-left:53px;} .ml53{margin-left:53px;}
.ml55{ margin-left:55px;} .ml55{ margin-left:55px;}
.ml58{margin-left:58px;} .ml58{margin-left:58px;}
@ -102,6 +103,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.mr50{margin-right: 50px;} .mr50{margin-right: 50px;}
.mr55{margin-right: 55px;} .mr55{margin-right: 55px;}
.mr60 {margin-right:60px;} .mr60 {margin-right:60px;}
.mr65 {margin-right:65px;}
.mr70{margin-right: 70px;} .mr70{margin-right: 70px;}
.mw15{margin:0 15px;} .mw15{margin:0 15px;}
.mr90 {margin-right:90px;} .mr90 {margin-right:90px;}
@ -113,6 +115,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.mt5{ margin-top:5px;} .mt5{ margin-top:5px;}
.mt8{ margin-top:8px;} .mt8{ margin-top:8px;}
.mt10{ margin-top:10px !important;} .mt10{ margin-top:10px !important;}
.mt20{margin-top: 20px;}
.mt30{ margin-top: 30px;} .mt30{ margin-top: 30px;}
.mt40{ margin-top: 40px;} .mt40{ margin-top: 40px;}
.mt12 { margin-top:12px !important;} .mt12 { margin-top:12px !important;}
@ -168,6 +171,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.h150{ height:150px;} .h150{ height:150px;}
.p10 {padding-left:10px; padding-right:10px;} .p10 {padding-left:10px; padding-right:10px;}
.mw400 {max-width: 400px;} .mw400 {max-width: 400px;}
.mh18 {max-height: 18px;}
/* Font & background Color */ /* Font & background Color */
a.b_grey{ background: #F5F5F5;} a.b_grey{ background: #F5F5F5;}
@ -1004,3 +1008,5 @@ a:hover.userCancel{border:1px solid #888888; }
.userCard em {display:block; border-width:8px; position:absolute; bottom:-17px; left:110px; border-style:solid dashed dashed dashed; border-color:#eaeaea transparent transparent transparent; font-size:0; line-height:0;} .userCard em {display:block; border-width:8px; position:absolute; bottom:-17px; left:110px; border-style:solid dashed dashed dashed; border-color:#eaeaea transparent transparent transparent; font-size:0; line-height:0;}
.userCardM {width:201px; height:20px; border:1px solid #dddddd; resize:none;} .userCardM {width:201px; height:20px; border:1px solid #dddddd; resize:none;}
.resourceCopy {padding:0px; margin:0px; width:12px; height:12px; display:inline-block;} .resourceCopy {padding:0px; margin:0px; width:12px; height:12px; display:inline-block;}
.relatePWrap{max-height: 210px;overflow:hidden;}