Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course

This commit is contained in:
cxt 2015-11-18 17:56:41 +08:00
commit 28f7390595
3 changed files with 14 additions and 3 deletions

View File

@ -1,7 +1,7 @@
class ExerciseController < ApplicationController
layout "base_courses"
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show]
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy]
before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list]
include ExerciseHelper
@ -102,7 +102,17 @@ class ExerciseController < ApplicationController
end
def destroy
if @exercise && @exercise.destroy
if @is_teacher
exercises = Exercise.where("course_id =?", @course.id)
else
exercises = Exercise.where("course_id =? and exercise_status =?", @course.id, 2)
end
@exercises = paginateHelper exercises,20 #分页
respond_to do |format|
format.js
end
end
end
# 统计结果

View File

@ -0,0 +1 @@
$("#exercise").html("<%= escape_javascript(render :partial => 'exercises_list') %>");

View File

@ -1,4 +1,4 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<div class="polls_content02" id="polls">
<div class="polls_content02" id="exercise">
<%= render :partial => 'exercises_list'%>
</div><!--问卷内容end-->