作业列表按更新时间排序 作业列表左上角添加作业的下拉列表

This commit is contained in:
cxt 2016-04-13 11:20:38 +08:00
parent 7fcd229f85
commit fcd1684658
3 changed files with 20 additions and 4 deletions

View File

@ -17,9 +17,11 @@ class HomeworkCommonController < ApplicationController
@page = params[:page] ? params[:page].to_i + 1 : 0
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
if @is_teacher
@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
@homeworks = @course.homework_commons.order("updated_at desc").limit(10).offset(@page * 10)
@homework_commons = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
else
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("updated_at desc").limit(10).offset(@page * 10)
@homework_commons = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
end
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
@is_new = params[:is_new]

View File

@ -39,7 +39,21 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">作业</div>
<!--<div class="NewsBannerName">作业</div>-->
<div id="menu_r" class="NewsBannerName" style="margin-bottom: -10px;">
<ul class="menu_r b_w" style="padding-left: 0px; margin-top: -5px;">
<li>
<a href="javascript:void(0);" class="parent" style="font-size:16px; color:#4b4b4b; font-weight: normal; padding-left: 0px;">作业</a>
<ul>
<% @homework_commons.each_with_index do |homework_common,index |%>
<li class="pr10">
<%= link_to "作业#{@homework_commons.count - index}#{homework_common.name}",student_work_index_path(:homework => homework_common.id)%>
</li>
<% end%>
</ul>
</li>
</ul>
</div>
<div id="search_div" class="fr mr10">
<%= render :partial => 'homework_search_form',:locals => {:course=>@course} %>
</div>

View File

@ -225,7 +225,7 @@ a.c_green{ color:#28be6c;}
.c_dblue{ color:#09658c;}
.b_blue{background:#64bdd9;}
.b_green{background:#28be6c;}
.b_w{ background:#fff;}
.b_w{ background:#fff !important;}
/*add by Tim*/
.fontGrey {color:#cecece;}