实践课程的金课配置

dev_aliyun
cxt 5 years ago
parent c71e5ea1ea
commit a6d88c6a6f

@ -2360,6 +2360,14 @@ end
end
end
# 实践课程的金课设置
def excellent_subject_setting
if params[:subject_id]
subject = Subject.find params[:subject_id]
subject.update_attributes(:excellent => !subject.excellent)
end
end
# 已发布实训路径首页显示
def subject_homepage_show
if params[:subject_id]

@ -10,7 +10,7 @@ class Subject < ActiveRecord::Base
belongs_to :major
# score_count 只能适合在首页使用
attr_accessible :description, :name, :status, :visits, :user_id, :course_list_id, :major_id, :learning_notes, :introduction,
:homepage_show, :score_count, :publish_time, :updated_at
:homepage_show, :score_count, :publish_time, :updated_at, :excellent
has_many :stages, :dependent => :destroy, :order => "stages.position ASC"
has_many :stage_shixuns, :dependent => :destroy

@ -3,7 +3,7 @@
<thead>
<tr>
<th width="9%">ID</th>
<th width="20%" class="edu-txt-left">实训套件名称</th>
<th width="18%" class="edu-txt-left">实训套件名称</th>
<th width="6%">阶段</th>
<th width="10%">技术体系</th>
<th width="10%">等级体系</th>
@ -75,6 +75,10 @@
<input type="checkbox" name="homepage_show" <%= c_shixun.status == 2 ? "" : "disabled" %> value="<%= c_shixun.id %>" <%= c_shixun.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="homepage_show_<%= c_shixun.id %>">
<label style="top:0px;padding-left: 19px;" for="homepage_show_<%= c_shixun.id %>">首页</label>
</span>
<span class="fl ml5">
<input type="checkbox" name="excellent" <%= c_shixun.status == 2 ? "" : "disabled" %> value="<%= c_shixun.id %>" <%= c_shixun.excellent ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="excellent_<%= c_shixun.id %>">
<label style="top:0px;padding-left: 19px;" for="excellent_<%= c_shixun.id %>">金课</label>
</span>
</td>
</tr>
<% end %>
@ -131,7 +135,16 @@
type: 'post',
dateType: "script"
});
})
});
$("input[name='excellent']").click(function(){
var subject_id = $(this).val();
$.ajax({
url:"<%= excellent_subject_setting_managements_path %>",
data: {subject_id: subject_id},
type: 'post',
dateType: "script"
});
});
});
function select_repertoire(subject_id, rep_id){
$.ajax({

@ -626,6 +626,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
post 'update_shixun_code_hidden'
get 'update_shixun_excute_time'
post 'subject_homepage_show'
post 'excellent_subject_setting'
post 'support_shixun'
post 'add_course'
match 'add_major',:via=>[:get,:post]

@ -0,0 +1,5 @@
class AddExcellentToSubject < ActiveRecord::Migration
def change
add_column :subjects, :excellent, :boolean, :default => false
end
end
Loading…
Cancel
Save