parent
94a711d8e0
commit
ff919bddae
@ -1,31 +1,42 @@
|
||||
$(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');
|
||||
$(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
|
||||
}
|
||||
}
|
||||
});
|
||||
$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');
|
||||
$modal.on('click', '.submit-btn', submit_edit_form);
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
$form.find("#discipline_name").keydown(function (e) {
|
||||
var ev = e || event;
|
||||
var keycode = ev.which || ev.keyCode;
|
||||
if (keycode == 13) {
|
||||
submit_edit_form();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submit_edit_form() {
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -1,31 +1,43 @@
|
||||
$(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');
|
||||
$(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
|
||||
}
|
||||
}
|
||||
});
|
||||
$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');
|
||||
$modal.on('click', '.submit-btn', submit_edit_form);
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
$form.find("#sub_discipline_name").keydown(function (e) {
|
||||
var ev = e || event;
|
||||
var keycode = ev.which || ev.keyCode;
|
||||
if (keycode == 13) {
|
||||
submit_edit_form();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submit_edit_form() {
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
@ -1,31 +1,42 @@
|
||||
$(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');
|
||||
$(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
|
||||
}
|
||||
}
|
||||
});
|
||||
$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');
|
||||
$modal.on('click', '.submit-btn', submit_edit_form);
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
$form.find("#tag_discipline_name").keydown(function (e) {
|
||||
var ev = e || event;
|
||||
var keycode = ev.which || ev.keyCode;
|
||||
if (keycode == 13) {
|
||||
submit_edit_form();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submit_edit_form() {
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -1,65 +1,76 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-sub-disciplines-index-page').length > 0) {
|
||||
$(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"]');
|
||||
// ============== 新建 ===============
|
||||
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
|
||||
}
|
||||
}
|
||||
});
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
$modal.on('click', '.submit-btn', submit_create_form);
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
$nameInput.keydown(function (e) {
|
||||
var ev = e || event;
|
||||
var keycode = ev.which || ev.keyCode;
|
||||
if (keycode == 13) {
|
||||
submit_create_form();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
function submit_create_form() {
|
||||
$form.find('.error').html('');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$(".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
|
||||
});
|
||||
});
|
||||
}
|
||||
$.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
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -1,65 +1,76 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-tag-disciplines-index-page').length > 0) {
|
||||
$(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"]');
|
||||
// ============== 新建 ===============
|
||||
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
|
||||
}
|
||||
}
|
||||
});
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
$modal.on('click', '.submit-btn', submit_create_form);
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
$nameInput.keydown(function (e) {
|
||||
var ev = e || event;
|
||||
var keycode = ev.which || ev.keyCode;
|
||||
if (keycode == 13) {
|
||||
submit_create_form();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
function submit_create_form() {
|
||||
$form.find('.error').html('');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$(".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
|
||||
});
|
||||
});
|
||||
}
|
||||
$.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,2 +1,6 @@
|
||||
<% if @message.present? %>
|
||||
$.notify({ message: "<%= @message %>" });
|
||||
<% else %>
|
||||
$('.modal.admin-edit-discipline-modal').modal("hide");
|
||||
$(".discipline-list-container").html("<%= j(render :partial => 'admins/disciplines/shared/list') %>");
|
||||
$(".discipline-list-container").html("<%= j(render :partial => 'admins/disciplines/shared/list') %>");
|
||||
<% end %>
|
@ -1,2 +1,6 @@
|
||||
<% if @message.present? %>
|
||||
$.notify({ message: "<%= @message %>" });
|
||||
<% else %>
|
||||
$('.modal.admin-edit-sub-discipline-modal').modal("hide");
|
||||
$(".sub-discipline-list-container").html("<%= j(render :partial => 'admins/sub_disciplines/shared/list') %>");
|
||||
$(".sub-discipline-list-container").html("<%= j(render :partial => 'admins/sub_disciplines/shared/list') %>");
|
||||
<% end %>
|
@ -1,2 +1,6 @@
|
||||
<% if @message.present? %>
|
||||
$.notify({ message: "<%= @message %>" });
|
||||
<% else %>
|
||||
$('.modal.admin-edit-tag-discipline-modal').modal("hide");
|
||||
$(".tag-discipline-list-container").html("<%= j(render :partial => 'admins/tag_disciplines/shared/list') %>");
|
||||
$(".tag-discipline-list-container").html("<%= j(render :partial => 'admins/tag_disciplines/shared/list') %>");
|
||||
<% end %>
|
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 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