课堂模块的隐藏

dev_forum
cxt 5 years ago
parent 81686af06f
commit 8f24996134

@ -2,10 +2,10 @@ class BoardsController < ApplicationController
before_action :require_login, :check_auth
before_action :find_course, only: [:create]
before_action :set_board, except: [:create]
before_action :teacher_allowed
before_action :teacher_or_admin_allowed
def index
@boards = @course.boards.includes(messages: [:last_reply, :author]);
@boards = @course.boards.includes(messages: [:last_reply, :author])
end
def show

@ -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

@ -1,7 +1,7 @@
class CourseSecondCategoriesController < ApplicationController
before_action :require_login, :check_auth
before_action :set_category
before_action :teacher_allowed
before_action :teacher_or_admin_allowed
# 目录重命名
def rename_category

@ -1057,6 +1057,7 @@ class CoursesController < ApplicationController
tip_exception("课堂名称应以课程名称开头命名") unless params[:course][:name].index(params[:course_list_name]) &&
params[:course][:name].index(params[:course_list_name]) == 0
tip_exception("课堂所属单位不能为空!") if params[:school].blank?
tip_exception("请至少添加一个课堂模块") if params[:course_module_types].blank?
@school = School.find_by!(name: params[:school].strip)
end

Loading…
Cancel
Save