diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 1e68ed2ed..687ef9503 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -147,6 +147,9 @@ class HomeworkCommonController < ApplicationController else @statue = 3 end + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i end #关闭匿评 @@ -162,6 +165,9 @@ class HomeworkCommonController < ApplicationController # 匿评关闭消息邮件通知 send_message_anonymous_comment(@homework, m_status = 3) Mailer.send_mail_anonymous_comment_close(@homework).deliver + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i respond_to do |format| format.js end @@ -188,6 +194,9 @@ class HomeworkCommonController < ApplicationController @homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count} end @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i respond_to do |format| format.js end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 6ad1a66b4..8590b836a 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -272,6 +272,7 @@ class WordsController < ApplicationController format.js{ @user_activity_id = params[:user_activity_id] @is_in_course = params[:is_in_course] + @course_activity = params[:course_activity] @homework_common_id = params[:homework_common_id] } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 795147446..e5cd9b52b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2307,15 +2307,15 @@ module ApplicationHelper end #获取匿评相关连接代码 - def homework_anonymous_comment homework + def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1) if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评" elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2 case homework.homework_detail_manual.comment_status when 1 - link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' + link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' when 2 - link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink' + link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink' when 3 # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" end diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index a03c4ccd7..2d3c72c20 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -57,12 +57,12 @@ module HomeworkCommonHelper end #根据传入作业确定跳转到开启匿评还是关闭匿评功能 - def alert_anonyoms_path homework,homework_detail_manual + def alert_anonyoms_path homework,homework_detail_manual,user_activity_id,is_in_course,course_activity link = "" if homework_detail_manual.comment_status == 1 - link = start_anonymous_comment_homework_common_url homework.id + link = start_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity elsif homework_detail_manual.comment_status == 2 - link = stop_anonymous_comment_homework_common_url homework.id + link = stop_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity end link end diff --git a/app/views/homework_common/_alert_anonyoms.html.erb b/app/views/homework_common/_alert_anonyoms.html.erb index 73f240b02..3b1f6f692 100644 --- a/app/views/homework_common/_alert_anonyoms.html.erb +++ b/app/views/homework_common/_alert_anonyoms.html.erb @@ -34,7 +34,7 @@
<% end %>