From f1c54bdee2cb3fc23d89cac38f90db805605297d Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 4 Nov 2019 16:39:58 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E7=9A=84=E9=82=AE=E4=BB=B6?=
=?UTF-8?q?=E9=80=9A=E7=9F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 10 ++++++++++
.../managements/_classroom_classment_list.html.erb | 11 +++++++++++
.../managements/course_board_email_notify.js.erb | 0
config/routes.rb | 1 +
4 files changed, 22 insertions(+)
create mode 100644 app/views/managements/course_board_email_notify.js.erb
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index df14dd53..06a09f93 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -2210,6 +2210,16 @@ end
end
end
+
+ # 讨论区邮件通知
+ def course_board_email_notify
+ if params[:course_id]
+ course = Course.find params[:course_id]
+ course.update_attributes(:email_notify => !course.email_notify)
+ end
+ end
+
+
# 课程实训
def class_shixuns
@menu_type = 4
diff --git a/app/views/managements/_classroom_classment_list.html.erb b/app/views/managements/_classroom_classment_list.html.erb
index 2b9c98cb..9321c495 100644
--- a/app/views/managements/_classroom_classment_list.html.erb
+++ b/app/views/managements/_classroom_classment_list.html.erb
@@ -40,6 +40,8 @@
<%= course.is_hidden ? "显示" : "隐藏" %>
class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>">
+ class="ml-3 mr5 magic-checkbox" id="email_notify_<%= course.id %>">
+
<% end %>
@@ -74,4 +76,13 @@
dateType: "script"
});
})
+ $("input[name='email_notify']").click(function(){
+ var course_id = $(this).val();
+ $.ajax({
+ url:"<%= course_board_email_notify_managements_path %>",
+ data: {course_id: course_id},
+ type: 'post',
+ dateType: "script"
+ });
+ })
diff --git a/app/views/managements/course_board_email_notify.js.erb b/app/views/managements/course_board_email_notify.js.erb
new file mode 100644
index 00000000..e69de29b
diff --git a/config/routes.rb b/config/routes.rb
index ef6d561c..49f180bb 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -625,6 +625,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'update_shixun_hidden'
get 'update_subject_hidden'
post 'course_homepage_show'
+ post 'course_board_email_notify'
post 'shixun_homepage_show'
post 'update_shixun_task_pass'
post 'update_shixun_code_hidden'