|
|
|
@ -2,7 +2,7 @@ class CourseModulesController < ApplicationController
|
|
|
|
|
before_action :require_login, :check_auth
|
|
|
|
|
before_action :set_module, except: [:unhidden_modules]
|
|
|
|
|
before_action :find_course, only: [:unhidden_modules]
|
|
|
|
|
before_action :teacher_allowed
|
|
|
|
|
before_action :teacher_or_admin_allowed
|
|
|
|
|
|
|
|
|
|
# 模块置顶
|
|
|
|
|
def sticky_module
|
|
|
|
@ -16,6 +16,7 @@ class CourseModulesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
# 模块隐藏
|
|
|
|
|
def hidden_module
|
|
|
|
|
tip_exception("请至少保留一个课堂模块") if @course.none_hidden_course_modules.where.not(id: @course_module.id).size == 0
|
|
|
|
|
@course_module.update_attributes(hidden: 1)
|
|
|
|
|
normal_status(0, "更新成功")
|
|
|
|
|
end
|
|
|
|
|