From 9f039a49aa9b113e9e090bda5d874f02f2951a65 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 2 Aug 2019 16:45:17 +0800 Subject: [PATCH] add delete course tiding --- app/controllers/courses_controller.rb | 2 ++ app/decorators/tiding_decorator.rb | 6 +++++- config/locales/tidings/zh-CN.yml | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index abc3e4856..9f62a03bb 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -234,6 +234,8 @@ class CoursesController < ApplicationController def destroy if @course.is_delete == 0 @course.delete! + Tiding.create!(user_id: @course.tea_id, trigger_user_id: 1, container_id: @course.id, + container_type: 'Course', tiding_type: 'Delete', extra: @course.name) normal_status(0, "成功") else normal_status(-1, "课堂已删除,无需重复操作") diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index 677812217..c7d914089 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -126,7 +126,11 @@ module TidingDecorator end def course_content - I18n.t(locale_format) % container.name + if tiding_type == 'Delete' + I18n.t(locale_format(tiding_type)) % extra + else + I18n.t(locale_format) % container.name + end end def shixun_content diff --git a/config/locales/tidings/zh-CN.yml b/config/locales/tidings/zh-CN.yml index 21d2d0879..e00407b28 100644 --- a/config/locales/tidings/zh-CN.yml +++ b/config/locales/tidings/zh-CN.yml @@ -55,6 +55,8 @@ "2_end": "你提交的试用授权申请,审核未通过
原因:%{reason}" Apply_end: "提交了试用授权申请" Course_end: "成功创建了课堂:%s" + Course: + Delete_end: "你删除了课堂:%s" Shixun_end: "成功创建了实训:%s" Subject_end: "成功创建了实训课程:%s" ArchiveCourse_end: "你的课堂已经归档:%s"