parent
94a711d8e0
commit
ff919bddae
@ -1,31 +1,42 @@
|
|||||||
$(document).on('turbolinks:load', function() {
|
$(document).on('turbolinks:load', function () {
|
||||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-discipline-modal', function(){
|
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-discipline-modal', function () {
|
||||||
var $modal = $('.modal.admin-edit-discipline-modal');
|
var $modal = $('.modal.admin-edit-discipline-modal');
|
||||||
var $form = $modal.find('form.admin-edit-discipline-form');
|
var $form = $modal.find('form.admin-edit-discipline-form');
|
||||||
|
|
||||||
$form.validate({
|
$form.validate({
|
||||||
errorElement: 'span',
|
errorElement: 'span',
|
||||||
errorClass: 'danger text-danger',
|
errorClass: 'danger text-danger',
|
||||||
rules: {
|
rules: {
|
||||||
'discipline[name]': {
|
'discipline[name]': {
|
||||||
required: true,
|
required: true,
|
||||||
maxlength: 20
|
maxlength: 20
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$modal.on('click', '.submit-btn', function(){
|
$modal.on('click', '.submit-btn', submit_edit_form);
|
||||||
$form.find('.error').html('');
|
|
||||||
var url = $form.attr('action');
|
|
||||||
|
|
||||||
if ($form.valid()) {
|
$form.find("#discipline_name").keydown(function (e) {
|
||||||
$.ajax({
|
var ev = e || event;
|
||||||
method: 'PATCH',
|
var keycode = ev.which || ev.keyCode;
|
||||||
dataType: 'script',
|
if (keycode == 13) {
|
||||||
url: url,
|
submit_edit_form();
|
||||||
data: $form.serialize()
|
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() {
|
$(document).on('turbolinks:load', function () {
|
||||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-sub-discipline-modal', function(){
|
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-sub-discipline-modal', function () {
|
||||||
var $modal = $('.modal.admin-edit-sub-discipline-modal');
|
var $modal = $('.modal.admin-edit-sub-discipline-modal');
|
||||||
var $form = $modal.find('form.admin-edit-sub-discipline-form');
|
var $form = $modal.find('form.admin-edit-sub-discipline-form');
|
||||||
|
|
||||||
$form.validate({
|
$form.validate({
|
||||||
errorElement: 'span',
|
errorElement: 'span',
|
||||||
errorClass: 'danger text-danger',
|
errorClass: 'danger text-danger',
|
||||||
rules: {
|
rules: {
|
||||||
'sub_discipline[name]': {
|
'sub_discipline[name]': {
|
||||||
required: true,
|
required: true,
|
||||||
maxlength: 20
|
maxlength: 20
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$modal.on('click', '.submit-btn', function(){
|
$modal.on('click', '.submit-btn', submit_edit_form);
|
||||||
$form.find('.error').html('');
|
|
||||||
var url = $form.attr('action');
|
|
||||||
|
|
||||||
if ($form.valid()) {
|
$form.find("#sub_discipline_name").keydown(function (e) {
|
||||||
$.ajax({
|
var ev = e || event;
|
||||||
method: 'PATCH',
|
var keycode = ev.which || ev.keyCode;
|
||||||
dataType: 'script',
|
if (keycode == 13) {
|
||||||
url: url,
|
submit_edit_form();
|
||||||
data: $form.serialize()
|
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() {
|
$(document).on('turbolinks:load', function () {
|
||||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-tag-discipline-modal', function(){
|
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-tag-discipline-modal', function () {
|
||||||
var $modal = $('.modal.admin-edit-tag-discipline-modal');
|
var $modal = $('.modal.admin-edit-tag-discipline-modal');
|
||||||
var $form = $modal.find('form.admin-edit-tag-discipline-form');
|
var $form = $modal.find('form.admin-edit-tag-discipline-form');
|
||||||
|
|
||||||
$form.validate({
|
$form.validate({
|
||||||
errorElement: 'span',
|
errorElement: 'span',
|
||||||
errorClass: 'danger text-danger',
|
errorClass: 'danger text-danger',
|
||||||
rules: {
|
rules: {
|
||||||
'tag_discipline[name]': {
|
'tag_discipline[name]': {
|
||||||
required: true,
|
required: true,
|
||||||
maxlength: 20
|
maxlength: 20
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$modal.on('click', '.submit-btn', function(){
|
$modal.on('click', '.submit-btn', submit_edit_form);
|
||||||
$form.find('.error').html('');
|
|
||||||
var url = $form.attr('action');
|
|
||||||
|
|
||||||
if ($form.valid()) {
|
$form.find("#tag_discipline_name").keydown(function (e) {
|
||||||
$.ajax({
|
var ev = e || event;
|
||||||
method: 'PATCH',
|
var keycode = ev.which || ev.keyCode;
|
||||||
dataType: 'script',
|
if (keycode == 13) {
|
||||||
url: url,
|
submit_edit_form();
|
||||||
data: $form.serialize()
|
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() {
|
$(document).on('turbolinks:load', function () {
|
||||||
if ($('body.admins-sub-disciplines-index-page').length > 0) {
|
if ($('body.admins-sub-disciplines-index-page').length > 0) {
|
||||||
|
|
||||||
// ============== 新建 ===============
|
// ============== 新建 ===============
|
||||||
var $modal = $('.modal.admin-create-sub-discipline-modal');
|
var $modal = $('.modal.admin-create-sub-discipline-modal');
|
||||||
var $form = $modal.find('form.admin-create-sub-discipline-form');
|
var $form = $modal.find('form.admin-create-sub-discipline-form');
|
||||||
var $nameInput = $form.find('input[name="name"]');
|
var $nameInput = $form.find('input[name="name"]');
|
||||||
|
|
||||||
$form.validate({
|
$form.validate({
|
||||||
errorElement: 'span',
|
errorElement: 'span',
|
||||||
errorClass: 'danger text-danger',
|
errorClass: 'danger text-danger',
|
||||||
rules: {
|
rules: {
|
||||||
name: {
|
name: {
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// modal ready fire
|
// modal ready fire
|
||||||
$modal.on('show.bs.modal', function () {
|
$modal.on('show.bs.modal', function () {
|
||||||
$nameInput.val('');
|
$nameInput.val('');
|
||||||
});
|
});
|
||||||
|
|
||||||
$modal.on('click', '.submit-btn', function(){
|
$modal.on('click', '.submit-btn', submit_create_form);
|
||||||
$form.find('.error').html('');
|
|
||||||
|
|
||||||
if ($form.valid()) {
|
$nameInput.keydown(function (e) {
|
||||||
var url = $form.data('url');
|
var ev = e || event;
|
||||||
|
var keycode = ev.which || ev.keyCode;
|
||||||
|
if (keycode == 13) {
|
||||||
|
submit_create_form();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.ajax({
|
function submit_create_form() {
|
||||||
method: 'POST',
|
$form.find('.error').html('');
|
||||||
dataType: 'json',
|
|
||||||
url: url,
|
|
||||||
data: $form.serialize(),
|
|
||||||
success: function(){
|
|
||||||
$.notify({ message: '创建成功' });
|
|
||||||
$modal.modal('hide');
|
|
||||||
|
|
||||||
setTimeout(function(){
|
if ($form.valid()) {
|
||||||
window.location.reload();
|
var url = $form.data('url');
|
||||||
}, 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 () {
|
$.ajax({
|
||||||
var s_id = $(this).attr("data-id");
|
method: 'POST',
|
||||||
var s_value = $(this).val();
|
dataType: 'json',
|
||||||
var s_name = $(this).attr("name");
|
url: url,
|
||||||
var json = {};
|
data: $form.serialize(),
|
||||||
json[s_name] = s_value;
|
success: function () {
|
||||||
$.ajax({
|
$.notify({message: '创建成功'});
|
||||||
url: "/admins/sub_disciplines/" + s_id,
|
$modal.modal('hide');
|
||||||
type: "PUT",
|
|
||||||
dataType:'script',
|
setTimeout(function () {
|
||||||
data: json
|
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() {
|
$(document).on('turbolinks:load', function () {
|
||||||
if ($('body.admins-tag-disciplines-index-page').length > 0) {
|
if ($('body.admins-tag-disciplines-index-page').length > 0) {
|
||||||
|
|
||||||
// ============== 新建 ===============
|
// ============== 新建 ===============
|
||||||
var $modal = $('.modal.admin-create-tag-discipline-modal');
|
var $modal = $('.modal.admin-create-tag-discipline-modal');
|
||||||
var $form = $modal.find('form.admin-create-tag-discipline-form');
|
var $form = $modal.find('form.admin-create-tag-discipline-form');
|
||||||
var $nameInput = $form.find('input[name="name"]');
|
var $nameInput = $form.find('input[name="name"]');
|
||||||
|
|
||||||
$form.validate({
|
$form.validate({
|
||||||
errorElement: 'span',
|
errorElement: 'span',
|
||||||
errorClass: 'danger text-danger',
|
errorClass: 'danger text-danger',
|
||||||
rules: {
|
rules: {
|
||||||
name: {
|
name: {
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// modal ready fire
|
// modal ready fire
|
||||||
$modal.on('show.bs.modal', function () {
|
$modal.on('show.bs.modal', function () {
|
||||||
$nameInput.val('');
|
$nameInput.val('');
|
||||||
});
|
});
|
||||||
|
|
||||||
$modal.on('click', '.submit-btn', function(){
|
$modal.on('click', '.submit-btn', submit_create_form);
|
||||||
$form.find('.error').html('');
|
|
||||||
|
|
||||||
if ($form.valid()) {
|
$nameInput.keydown(function (e) {
|
||||||
var url = $form.data('url');
|
var ev = e || event;
|
||||||
|
var keycode = ev.which || ev.keyCode;
|
||||||
|
if (keycode == 13) {
|
||||||
|
submit_create_form();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.ajax({
|
function submit_create_form() {
|
||||||
method: 'POST',
|
$form.find('.error').html('');
|
||||||
dataType: 'json',
|
|
||||||
url: url,
|
|
||||||
data: $form.serialize(),
|
|
||||||
success: function(){
|
|
||||||
$.notify({ message: '创建成功' });
|
|
||||||
$modal.modal('hide');
|
|
||||||
|
|
||||||
setTimeout(function(){
|
if ($form.valid()) {
|
||||||
window.location.reload();
|
var url = $form.data('url');
|
||||||
}, 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 () {
|
$.ajax({
|
||||||
var s_id = $(this).attr("data-id");
|
method: 'POST',
|
||||||
var s_value = $(this).val();
|
dataType: 'json',
|
||||||
var s_name = $(this).attr("name");
|
url: url,
|
||||||
var json = {};
|
data: $form.serialize(),
|
||||||
json[s_name] = s_value;
|
success: function () {
|
||||||
$.ajax({
|
$.notify({message: '创建成功'});
|
||||||
url: "/admins/tag_disciplines/" + s_id,
|
$modal.modal('hide');
|
||||||
type: "PUT",
|
|
||||||
dataType:'script',
|
setTimeout(function () {
|
||||||
data: json
|
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");
|
$('.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");
|
$('.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");
|
$('.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