parent
6d04519e2b
commit
8e87b085ad
@ -0,0 +1,18 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-subject-modal', function(){
|
||||
var $modal = $('.modal.admin-edit-subject-modal');
|
||||
var $form = $modal.find('form.admin-edit-subject-form');
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
@ -0,0 +1,2 @@
|
||||
$('.admin-modal-container').html("<%= j( render partial: 'admins/subjects/shared/edit_subject_modal', locals: { subject: @subject } ) %>");
|
||||
$('.modal.admin-edit-subject-modal').modal('show');
|
@ -0,0 +1,33 @@
|
||||
<div class="modal fade admin-edit-subject-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, subject], html: { class: 'admin-edit-subject-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :repertoire_id, label: '技术体系:' do %>
|
||||
<% repertoire_options = Repertoire.order('CONVERT(name USING gbk) COLLATE gbk_chinese_ci ASC').map{|r| [r.name, r.id]} %>
|
||||
<%= f.select :repertoire_id, [['请选择', '']] + repertoire_options, {}, class: 'form-control' %>
|
||||
<% end %>
|
||||
|
||||
<%= f.input :subject_level_system_id, label: '等级体系:' do %>
|
||||
<% level_options = SubjectLevelSystem.all.map{|r| [r.name, r.id]} %>
|
||||
<%= f.select :subject_level_system_id, [['请选择', '']] + level_options, {}, class: 'form-control' %>
|
||||
<% end %>
|
||||
|
||||
<%= f.input :student_count, as: :integer, 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>
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in new issue