diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index d1df22dff..0b1a035c1 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -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| diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index 40654d327..d7a457047 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -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" %> @@ -16,8 +16,10 @@ <% if exercise.exercise_status == 1 %>
  • <%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml5"%>
  • +
  • <%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%>
  • <% else%>
  • 编辑
  • +
  • 已发布
  • <% end%> <%# if exercise.exercise_status == 2 %> @@ -31,11 +33,6 @@ <%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %> <%# end%> - - -
  • <%= format_date exercise.created_at.to_date%>
  • - - <% if exercise.exercise_status == 1 %>
  • 发布试卷
  • <% 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%> -
  • <%= format_date exercise.created_at.to_date%>
  • +
  • 截止时间:<%= format_time(exercise.end_time.to_s)%>
  • <% end%> \ No newline at end of file diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb index f277ebdf5..89964f032 100644 --- a/app/views/exercise/_exercises_list.html.erb +++ b/app/views/exercise/_exercises_list.html.erb @@ -10,9 +10,9 @@
    - <% @exercises.each do |exercise|%> + <% @exercises.each_with_index do |exercise,index|%>
    <% end%>