From f3246b99c9eaa36e2f8c2ae3a123f8d2addfb0f9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 26 May 2015 11:24:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 7 +++++-- app/views/homework_common/stop_anonymous_comment.js.erb | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 app/views/homework_common/stop_anonymous_comment.js.erb diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d1c2b4bac..fb22d6378 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -1,7 +1,7 @@ class HomeworkCommonController < ApplicationController layout "base_courses" before_filter :find_course, :only => [:index,:new,:create] - before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment] + before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] def index @@ -152,7 +152,10 @@ class HomeworkCommonController < ApplicationController #关闭匿评 def stop_anonymous_comment - + @homework_detail_manual.update_column('comment_status', 3) + respond_to do |format| + format.js + end end #提示 diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb new file mode 100644 index 000000000..9a6131c64 --- /dev/null +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -0,0 +1,2 @@ +$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('匿评结束'); +alert('关闭成功'); \ No newline at end of file