添加专业

This commit is contained in:
XuCheng642 2017-08-11 19:59:19 +08:00
parent 5d202914a6
commit 22387dfdcf
4 changed files with 37 additions and 16 deletions

View File

@ -41,6 +41,7 @@ class ManagementsController < ApplicationController
def applicable_course
@menu_type = 12
@sub_type = 2
@major = Major.where(:major_level => 2)
@courselist = CourseList.where("0=0")
search=params[:search]
unless search.blank?
@ -65,9 +66,17 @@ end
courselist= CourseList.create(:name => params[:course])
redirect_to applicable_course_managements_path
end
# 增加课程所属专业
def add_major
@major = Major.where("0=0")
if prams[:major] && params[:major] != 0
major = MajorCourse.create(:course_list_id=> "15",:major_id => "#{params[:major]}")
end
redirect_to applicable_course_managements_path
end
# 单位部门列表
def departments
@menu_type = 6
@ -722,7 +731,7 @@ end
def shixun_authorization
@menu_type = 10
@sub_type == 5
@sub_type = 5
@type = trial_authorization_status params[:type]
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc")
search = params[:search]

View File

@ -56,21 +56,33 @@
</div>
</div>
<script>
function add_major(){
var htmlvalue ='<%#= form_tag(url_for(add_major_managements_path),:id=>"add_major",:method => "post",:remote=>true) do %>'+
'<div style="width:300px" class="task-popup">'+
'<b class="ml10 mt20 mb 20">适用课程添加所属专业</b>'+
'<select class="fl task-height-30">' +
function add_major(){
var htmlvalue ='<%= form_tag(url_for(add_major_managements_path),:id=>"add_major",:method => "post") do %>'+
'<div style="width:400px" class="task-popup"><div class="task-popup-title clearfix "><h3 class="fl color-grey">适用课程添加所属专业</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5 "></i></a>'+
'<select class="mt20 ml75 mb20" id="major">' +
'<option value="0" selected="selected">请选择支撑实训的专业名称</option>'+
// '<%# get_course_list_major(@courselist.id).each_with_index do |smc, j| %>'+
// '<option value="<%#= smc.id %>"><%#= smc.name %>'+
// '</option>'+
// '<%# end %>'+
'<% @major.each do |major| %>'+
'<option value="<% major.id %>"><%= major.name %></option>'+
'<% end %>'+
'</select>' +
'</div>'
'<%# end %>';
pop_box_new(htmlvalue, 300, 400)
'<span class="color-orange fl none" style="margin-left: 17%;" id="new_major_name_notice">'+
'<i class="fa fa-exclamation-circle mr5" ></i>'+
'请先选择要支撑实训的专业名称</span>'+
'<div class="cl"></div>' +
'<div class="task-popup-submit clearfix ml25">' +
'<a href="javascript:void(0);" class="task-btn fl pop_close mr10">取消</a>' +
'<a href="javascript:void(0);" onclick="submit_new_major();" class="task-btn task-btn-blue fr" >确定</a>' +
'</div>' +
'</div>'+
'</div>'+
'<% end %>';
pop_box_new(htmlvalue, 400, 160)
}
function submit_new_major() {
$("#add_major").submit();
}
</script>

View File

@ -22,7 +22,7 @@
<label for="authorization_<%= user.id %>">&nbsp;</label>
</td>
<td>
<%= user.id %>
<%= user.login %>
</td>
<td>
<%= link_to user.try(:show_real_name), user_path(user), :class => "edu-txt-w100 task-hide2" %>

View File

@ -183,7 +183,7 @@ RedmineApp::Application.routes.draw do
post 'course_homepage_show'
post 'shixun_homepage_show'
post 'add_course'
get 'add_major'
match 'add_major',:via=>[:get,:post]
end
end
# Enable Grack support