实训课程关联课程体系

dev_SaaS
daiao 6 years ago
parent 08a4357405
commit cca7aabf84

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

@ -1,4 +1,6 @@
class SubjectLevelSystem < ActiveRecord::Base
default_scope :order => 'level'
# attr_accessible :title, :body
has_many :subjects

@ -28,8 +28,11 @@
</select>
</td>
<td>
<select>
<option>请选择等级</option>
<select onchange="select_subject_level(<%= c_shixun.id %>, this.options[this.options.selectedIndex].value)">
<option <%= c_shixun.subject_level_system_id.present? ? "" : "selected='selected'".html_safe %> value="-1" >请选择课程体系</option>
<% @levels.each do |l| %>
<option value="<%= l.id %>" <%= l.id == c_shixun.subject_level_system_id ? "selected='selected'".html_safe : "" %> ><%= l.name %></option>
<% end %>
</select>
</td>
<td>
@ -140,4 +143,16 @@
});
}
function select_subject_level(subject_id, level_id){
$.ajax({
url: "<%=update_level_for_subject_managements_path %>",
data: {subject_id: subject_id, level_id: level_id},
type: "POST",
success: function(data){
notice_box("关联成功!");
}
});
}
</script>

@ -677,6 +677,7 @@ RedmineApp::Application.routes.draw do
post 'create_subject_level'
post 'rename_subject_level'
post 'delete_subject_level'
post 'update_level_for_subject'
end
end
# Enable Grack support

Loading…
Cancel
Save