parent
4a51439bea
commit
a977034c01
@ -0,0 +1,65 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-disciplines-index-page').length > 0) {
|
||||
|
||||
// ============== 新建 ===============
|
||||
var $modal = $('.modal.admin-create-discipline-modal');
|
||||
var $form = $modal.find('form.admin-create-discipline-form');
|
||||
var $nameInput = $form.find('input[name="name"]');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".discipline-list-container").on("change", '.discipline-source-form', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var s_value = $(this).val();
|
||||
var s_name = $(this).attr("name");
|
||||
var json = {};
|
||||
json[s_name] = s_value;
|
||||
$.ajax({
|
||||
url: "/admins/disciplines/" + s_id,
|
||||
type: "PUT",
|
||||
dataType:'script',
|
||||
data: json
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,31 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-discipline-modal', function(){
|
||||
var $modal = $('.modal.admin-edit-discipline-modal');
|
||||
var $form = $modal.find('form.admin-edit-discipline-form');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
'discipline[name]': {
|
||||
required: true,
|
||||
maxlength: 20
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,31 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-sub-discipline-modal', function(){
|
||||
var $modal = $('.modal.admin-edit-sub-discipline-modal');
|
||||
var $form = $modal.find('form.admin-edit-sub-discipline-form');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
'sub_discipline[name]': {
|
||||
required: true,
|
||||
maxlength: 20
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,31 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-tag-discipline-modal', function(){
|
||||
var $modal = $('.modal.admin-edit-tag-discipline-modal');
|
||||
var $form = $modal.find('form.admin-edit-tag-discipline-form');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
'tag_discipline[name]': {
|
||||
required: true,
|
||||
maxlength: 20
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,65 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-sub-disciplines-index-page').length > 0) {
|
||||
|
||||
// ============== 新建 ===============
|
||||
var $modal = $('.modal.admin-create-sub-discipline-modal');
|
||||
var $form = $modal.find('form.admin-create-sub-discipline-form');
|
||||
var $nameInput = $form.find('input[name="name"]');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".sub-discipline-list-container").on("change", '.sub-discipline-source-form', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var s_value = $(this).val();
|
||||
var s_name = $(this).attr("name");
|
||||
var json = {};
|
||||
json[s_name] = s_value;
|
||||
$.ajax({
|
||||
url: "/admins/sub_disciplines/" + s_id,
|
||||
type: "PUT",
|
||||
dataType:'script',
|
||||
data: json
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,65 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-tag-disciplines-index-page').length > 0) {
|
||||
|
||||
// ============== 新建 ===============
|
||||
var $modal = $('.modal.admin-create-tag-discipline-modal');
|
||||
var $form = $modal.find('form.admin-create-tag-discipline-form');
|
||||
var $nameInput = $form.find('input[name="name"]');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".tag-discipline-list-container").on("change", '.tag-discipline-source-form', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var s_value = $(this).val();
|
||||
var s_name = $(this).attr("name");
|
||||
var json = {};
|
||||
json[s_name] = s_value;
|
||||
$.ajax({
|
||||
url: "/admins/tag_disciplines/" + s_id,
|
||||
type: "PUT",
|
||||
dataType:'script',
|
||||
data: json
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -1,6 +1,41 @@
|
||||
class Admins::DisciplinesController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@disciplines = Discipline.all
|
||||
end
|
||||
|
||||
def create
|
||||
name = params[:name].to_s.strip
|
||||
return render_error('名称重复') if Discipline.where(name: name).exists?
|
||||
Discipline.create!(name: name)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def edit
|
||||
@discipline = current_discipline
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:discipline] && params[:discipline][:name].present?
|
||||
name = params[:discipline][:name].to_s.strip
|
||||
current_discipline.update_attributes!(name: name)
|
||||
else
|
||||
current_discipline.update_attributes!(setting_params)
|
||||
end
|
||||
@disciplines = Discipline.all
|
||||
end
|
||||
|
||||
def destroy
|
||||
@discipline_id = params[:id]
|
||||
current_discipline.destroy!
|
||||
end
|
||||
|
||||
private
|
||||
def current_discipline
|
||||
@_current_discipline = Discipline.find params[:id]
|
||||
end
|
||||
|
||||
def setting_params
|
||||
params.permit(:shixun, :subject, :question)
|
||||
end
|
||||
end
|
@ -0,0 +1,47 @@
|
||||
class Admins::SubDisciplinesController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@discipline = current_discipline
|
||||
@sub_disciplines = current_discipline.sub_disciplines
|
||||
end
|
||||
|
||||
def create
|
||||
name = params[:name].to_s.strip
|
||||
return render_error('名称重复') if current_discipline.sub_disciplines.where(name: name).exists?
|
||||
SubDiscipline.create!(name: name, discipline_id: current_discipline.id)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def edit
|
||||
@sub_discipline = current_sub_discipline
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:sub_discipline] && params[:sub_discipline][:name].present?
|
||||
name = params[:sub_discipline][:name].to_s.strip
|
||||
current_sub_discipline.update_attributes!(name: name)
|
||||
else
|
||||
current_sub_discipline.update_attributes!(setting_params)
|
||||
end
|
||||
@sub_disciplines = current_sub_discipline.discipline&.sub_disciplines
|
||||
end
|
||||
|
||||
def destroy
|
||||
@sub_discipline_id = params[:id]
|
||||
current_sub_discipline.destroy!
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_sub_discipline
|
||||
@_current_sub_discipline = SubDiscipline.find params[:id]
|
||||
end
|
||||
|
||||
def current_discipline
|
||||
@_current_discipline = Discipline.find params[:discipline_id]
|
||||
end
|
||||
|
||||
def setting_params
|
||||
params.permit(:shixun, :subject, :question)
|
||||
end
|
||||
end
|
@ -0,0 +1,47 @@
|
||||
class Admins::TagDisciplinesController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@sub_discipline = current_sub_discipline
|
||||
@tag_disciplines = current_sub_discipline.tag_disciplines
|
||||
end
|
||||
|
||||
def create
|
||||
name = params[:name].to_s.strip
|
||||
return render_error('名称重复') if current_sub_discipline.tag_disciplines.where(name: name).exists?
|
||||
TagDiscipline.create!(name: name, sub_discipline_id: current_sub_discipline.id)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def edit
|
||||
@tag_discipline = current_tag_discipline
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:tag_discipline] && params[:tag_discipline][:name].present?
|
||||
name = params[:tag_discipline][:name].to_s.strip
|
||||
current_tag_discipline.update_attributes!(name: name)
|
||||
else
|
||||
current_tag_discipline.update_attributes!(setting_params)
|
||||
end
|
||||
@tag_disciplines = current_tag_discipline.sub_discipline&.tag_disciplines
|
||||
end
|
||||
|
||||
def destroy
|
||||
@tag_discipline_id = params[:id]
|
||||
current_tag_discipline.destroy!
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_sub_discipline
|
||||
@_current_sub_discipline = SubDiscipline.find params[:sub_discipline_id]
|
||||
end
|
||||
|
||||
def current_tag_discipline
|
||||
@_current_tag_discipline = TagDiscipline.find params[:id]
|
||||
end
|
||||
|
||||
def setting_params
|
||||
params.permit(:shixun, :subject, :question)
|
||||
end
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
$.notify({ message: '删除成功' });
|
||||
$(".discipline-item-<%= @discipline_id %>").remove();
|
@ -0,0 +1,2 @@
|
||||
$('.admin-modal-container').html("<%= j( render partial: 'admins/disciplines/shared/edit_discipline_modal', locals: { discipline: @discipline } ) %>");
|
||||
$('.modal.admin-edit-discipline-modal').modal('show');
|
@ -0,0 +1,13 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('课程方向', admins_disciplines_path) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container discipline-list-form">
|
||||
<%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-discipline-modal' } %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container discipline-list-container">
|
||||
<%= render(partial: 'admins/disciplines/shared/list') %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/disciplines/shared/create_discipline_modal' %>
|
@ -0,0 +1,28 @@
|
||||
<div class="modal fade admin-create-discipline-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">新建课程方向</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="admin-create-discipline-form" data-url="<%= admins_disciplines_path %>">
|
||||
<div class="form-group d-flex">
|
||||
<label for="new_mirror_id" class="col-form-label">名称:</label>
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入名称') %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,23 @@
|
||||
<div class="modal fade admin-edit-discipline-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">编辑课程方向</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<%= simple_form_for([:admins, discipline], html: { class: 'admin-edit-discipline-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :name, as: :string, label: '名称' %>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,33 @@
|
||||
<table class="table table-hover text-center discipline-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="54%" class="text-left">课程方向</th>
|
||||
<th width="8%">实践课程</th>
|
||||
<th width="8%">实训</th>
|
||||
<th width="8%">题库</th>
|
||||
<th width="16%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @disciplines.present? %>
|
||||
<% @disciplines.each_with_index do |discipline, index| %>
|
||||
<tr class="discipline-item discipline-item-<%= discipline.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left">
|
||||
<span><%= link_to discipline.name, admins_sub_disciplines_path(discipline_id: discipline), :title => discipline.name %></span>
|
||||
</td>
|
||||
<td><%= check_box_tag :subject,!discipline.subject,discipline.subject,remote:true,data:{id:discipline.id},class:"discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :shixun,!discipline.shixun,discipline.shixun,remote:true,data:{id:discipline.id},class:"discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :question,!discipline.question,discipline.question,remote:true,data:{id:discipline.id},class:"discipline-source-form" %></td>
|
||||
<td>
|
||||
<%= link_to '编辑', edit_admins_discipline_path(discipline), remote: true, class: 'action' %>
|
||||
<%= delete_link '删除', admins_discipline_path(discipline, element: ".discipline-item-#{discipline.id}"), class: 'delete-discipline-action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,2 @@
|
||||
$('.modal.admin-edit-discipline-modal').modal("hide");
|
||||
$(".discipline-list-container").html("<%= j(render :partial => 'admins/disciplines/shared/list') %>");
|
@ -0,0 +1,2 @@
|
||||
$.notify({ message: '删除成功' });
|
||||
$(".sub-discipline-item-<%= @sub_discipline_id %>").remove();
|
@ -0,0 +1,2 @@
|
||||
$('.admin-modal-container').html("<%= j( render partial: 'admins/sub_disciplines/shared/edit_sub_discipline_modal', locals: { sub_discipline: @sub_discipline } ) %>");
|
||||
$('.modal.admin-edit-sub-discipline-modal').modal('show');
|
@ -0,0 +1,14 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('课程方向', admins_disciplines_path) %>
|
||||
<% add_admin_breadcrumb(@discipline.name) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container sub-discipline-list-form">
|
||||
<%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-sub-discipline-modal' } %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container sub-discipline-list-container">
|
||||
<%= render(partial: 'admins/sub_disciplines/shared/list') %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/sub_disciplines/shared/create_sub_discipline_modal' %>
|
@ -0,0 +1,28 @@
|
||||
<div class="modal fade admin-create-sub-discipline-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">新建课程</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="admin-create-sub-discipline-form" data-url="<%= admins_sub_disciplines_path(discipline_id: @discipline) %>">
|
||||
<div class="form-group d-flex">
|
||||
<label for="new_mirror_id" class="col-form-label">名称:</label>
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入名称') %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,23 @@
|
||||
<div class="modal fade admin-edit-sub-discipline-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">编辑课程</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<%= simple_form_for([:admins, sub_discipline], html: { class: 'admin-edit-sub-discipline-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :name, as: :string, label: '名称' %>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,33 @@
|
||||
<table class="table table-hover text-center sub-discipline-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="54%" class="text-left">课程</th>
|
||||
<th width="8%">实践课程</th>
|
||||
<th width="8%">实训</th>
|
||||
<th width="8%">题库</th>
|
||||
<th width="16%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @sub_disciplines.present? %>
|
||||
<% @sub_disciplines.each_with_index do |sub, index| %>
|
||||
<tr class="sub-discipline-item sub-discipline-item-<%= sub.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left">
|
||||
<span><%= link_to sub.name, admins_tag_disciplines_path(sub_discipline_id: sub), :title => sub.name %></span>
|
||||
</td>
|
||||
<td><%= check_box_tag :subject,!sub.subject,sub.subject,remote:true,data:{id:sub.id},class:"sub-discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :shixun,!sub.shixun,sub.shixun,remote:true,data:{id:sub.id},class:"sub-discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :question,!sub.question,sub.question,remote:true,data:{id:sub.id},class:"sub-discipline-source-form" %></td>
|
||||
<td>
|
||||
<%= link_to '编辑', edit_admins_sub_discipline_path(sub), remote: true, class: 'action' %>
|
||||
<%= delete_link '删除', admins_sub_discipline_path(sub, element: ".sub-discipline-item-#{sub.id}"), class: 'delete-sub-discipline-action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,2 @@
|
||||
$('.modal.admin-edit-sub-discipline-modal').modal("hide");
|
||||
$(".sub-discipline-list-container").html("<%= j(render :partial => 'admins/sub_disciplines/shared/list') %>");
|
@ -0,0 +1,2 @@
|
||||
$.notify({ message: '删除成功' });
|
||||
$(".tag-discipline-item-<%= @tag_discipline_id %>").remove();
|
@ -0,0 +1,2 @@
|
||||
$('.admin-modal-container').html("<%= j( render partial: 'admins/tag_disciplines/shared/edit_tag_discipline_modal', locals: { tag_discipline: @tag_discipline } ) %>");
|
||||
$('.modal.admin-edit-tag-discipline-modal').modal('show');
|
@ -0,0 +1,15 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('课程方向', admins_disciplines_path) %>
|
||||
<% add_admin_breadcrumb(@sub_discipline&.discipline&.name, admins_sub_disciplines_path(discipline_id: @sub_discipline&.discipline_id)) %>
|
||||
<% add_admin_breadcrumb(@sub_discipline.name) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container tag-discipline-list-form">
|
||||
<%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-tag-discipline-modal' } %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container tag-discipline-list-container">
|
||||
<%= render(partial: 'admins/tag_disciplines/shared/list') %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/tag_disciplines/shared/create_tag_discipline_modal' %>
|
@ -0,0 +1,28 @@
|
||||
<div class="modal fade admin-create-tag-discipline-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">新建知识点</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="admin-create-tag-discipline-form" data-url="<%= admins_tag_disciplines_path(sub_discipline_id: @sub_discipline) %>">
|
||||
<div class="form-group d-flex">
|
||||
<label for="new_mirror_id" class="col-form-label">名称:</label>
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入名称') %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,23 @@
|
||||
<div class="modal fade admin-edit-tag-discipline-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">编辑知识点</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<%= simple_form_for([:admins, tag_discipline], html: { class: 'admin-edit-tag-discipline-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :name, as: :string, label: '名称' %>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,31 @@
|
||||
<table class="table table-hover text-center tag-discipline-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="54%" class="text-left">知识点</th>
|
||||
<th width="8%">实践课程</th>
|
||||
<th width="8%">实训</th>
|
||||
<th width="8%">题库</th>
|
||||
<th width="16%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @tag_disciplines.present? %>
|
||||
<% @tag_disciplines.each_with_index do |tag, index| %>
|
||||
<tr class="tag-discipline-item tag-discipline-item-<%= tag.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left"><%= tag.name %></td>
|
||||
<td><%= check_box_tag :subject,!tag.subject,tag.subject,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :shixun,!tag.shixun,tag.shixun,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :question,!tag.question,tag.question,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %></td>
|
||||
<td>
|
||||
<%= link_to '编辑', edit_admins_tag_discipline_path(tag), remote: true, class: 'action' %>
|
||||
<%= delete_link '删除', admins_tag_discipline_path(tag, element: ".tag-discipline-item-#{tag.id}"), class: 'delete-tag-discipline-action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,2 @@
|
||||
$('.modal.admin-edit-tag-discipline-modal').modal("hide");
|
||||
$(".tag-discipline-list-container").html("<%= j(render :partial => 'admins/tag_disciplines/shared/list') %>");
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in new issue