diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 9502ee76..e1d89df0 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -16,6 +16,13 @@ class ManagementsController < ApplicationController CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z) + # 更新实训课程的等级 + def update_level_for_subject + subject = Subject.find params[:subject_id] + subject.update_attribute(:subject_level_system_id, params[:level_id]) + render :json => {status: 1} + end + # 实训课程等级体系 def subject_level_system @levels = SubjectLevelSystem.all @@ -1964,6 +1971,7 @@ end @audit_class_sx_num=Subject.where(:status => 1).count @publish_class_sx_num=Subject.where(:status => 2).count @repertories = Repertoire.where(nil).order("CONVERT( name USING gbk ) COLLATE gbk_chinese_ci ASC") + @levels = SubjectLevelSystem.all search = params[:search] # 搜索字 keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索 status = params[:status].to_i diff --git a/app/models/subject_level_system.rb b/app/models/subject_level_system.rb index 6ba73437..dae815b2 100644 --- a/app/models/subject_level_system.rb +++ b/app/models/subject_level_system.rb @@ -1,4 +1,6 @@ class SubjectLevelSystem < ActiveRecord::Base + default_scope :order => 'level' + # attr_accessible :title, :body has_many :subjects diff --git a/app/views/managements/_subject_list.html.erb b/app/views/managements/_subject_list.html.erb index abc18548..40a3b0c4 100644 --- a/app/views/managements/_subject_list.html.erb +++ b/app/views/managements/_subject_list.html.erb @@ -28,8 +28,11 @@