测验列表的创建时间改成截止时间,每个测验名字前增加序号,显示发布状态

This commit is contained in:
cxt 2015-11-26 14:36:19 +08:00
parent cbdc6bb889
commit f1bb1bb8c2
3 changed files with 8 additions and 11 deletions

View File

@ -13,9 +13,9 @@ class ExerciseController < ApplicationController
remove_invalid_exercise(@course)
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
if @is_teacher
exercises = @course.exercises
exercises = @course.exercises.order("created_at asc")
else
exercises = @course.exercises.where(:exercise_status => 2)
exercises = @course.exercises.where(:exercise_status => 2).order("created_at asc")
end
@exercises = paginateHelper exercises,20 #分页
respond_to do |format|

View File

@ -8,7 +8,7 @@
<%# else %>
<%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
<%# end %>
<%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
<%= link_to (index+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
</div>
</li>
@ -16,8 +16,10 @@
<% if exercise.exercise_status == 1 %>
<li><%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml5"%></li>
<li class="polls_date fr"><%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%></li>
<% else%>
<li class="polls_de_grey fr ml5" title="未发布的试卷才能进行编辑">编辑</li>
<li class="polls_date fr">已发布</li>
<% end%>
<%# if exercise.exercise_status == 2 %>
@ -31,11 +33,6 @@
<%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
<%# end%>
<li class="polls_date fr"><%= format_date exercise.created_at.to_date%></li>
<% if exercise.exercise_status == 1 %>
<li><a href="javascript:" class="pollsbtn btn_pu fr mr5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>);">发布试卷</a></li>
<% elsif exercise.exercise_status == 2%>
@ -59,5 +56,5 @@
<%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
<%#end%>
<% end%>
<li class="polls_date fr mr10"><%= format_date exercise.created_at.to_date%></li>
<li class="polls_date fr mr10">截止时间:<%= format_time(exercise.end_time.to_s)%></li>
<% end%>

View File

@ -10,9 +10,9 @@
<div class="cl"></div>
<div id="polls_list" class="polls_list">
<% @exercises.each do |exercise|%>
<% @exercises.each_with_index do |exercise,index|%>
<ul id="exercises_<%= exercise.id %>" class="polls_list_ul">
<%= render :partial => 'exercise', :locals => {:exercise => exercise} %>
<%= render :partial => 'exercise', :locals => {:exercise => exercise,:index => index} %>
</ul>
<div class="cl"></div>
<% end%>