mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-03 19:24:48 +08:00
fix error message when editing custom column on locked task
This commit is contained in:
parent
7a4e3201e7
commit
4792bd87b9
2 changed files with 50 additions and 28 deletions
|
@ -1193,34 +1193,56 @@ function changeToEditMode() {
|
|||
|
||||
cancelEditMode();
|
||||
|
||||
var self = $(this);
|
||||
var li = self.closest('li');
|
||||
var text = li.find('.text');
|
||||
if ($(text).find('.modal-tooltiptext').length > 0) {
|
||||
text = $(text).find('.modal-tooltiptext');
|
||||
var li = $(this).closest('li');
|
||||
var url = li.attr('data-edit-url') + "/electronic_sign_edit";
|
||||
ajaxCallEvent();
|
||||
|
||||
function ajaxCallEvent(){
|
||||
$.ajax({
|
||||
url: url,
|
||||
success: function() {
|
||||
var text = li.find('.text');
|
||||
if ($(text).find('.modal-tooltiptext').length > 0) {
|
||||
text = $(text).find('.modal-tooltiptext');
|
||||
}
|
||||
var textEdit = li.find('.text-edit');
|
||||
var controls = li.find('.controls .vis,.edit,.del');
|
||||
var controlsEdit = li.find('.controls .ok,.cancel');
|
||||
|
||||
// Toggle edit mode
|
||||
columnEditMode = true;
|
||||
li.addClass('editing');
|
||||
|
||||
// Set the text-edit's value
|
||||
textEdit.val(text.text().trim());
|
||||
|
||||
// Toggle elements
|
||||
text.hide();
|
||||
controls.hide();
|
||||
textEdit.css('display', ''); // show() doesn't work
|
||||
controlsEdit.css('display', ''); // show() doesn't work
|
||||
dropdownList.sortable('disable');
|
||||
dropdownList.on('click', function(ev) {
|
||||
ev.stopPropagation();
|
||||
});
|
||||
// Focus input
|
||||
textEdit.focus();
|
||||
},
|
||||
error: function(e) {
|
||||
$(li).clearFormErrors();
|
||||
var msg = $.parseJSON(e.responseText);
|
||||
|
||||
renderFormError(undefined,
|
||||
$(li).find('.text-edit'),
|
||||
Object.keys(msg)[0] + ' ' + msg.name.toString());
|
||||
var verticalHeight = $(li).offset().top;
|
||||
dropdownList.scrollTo(verticalHeight,0);
|
||||
setTimeout(function() {
|
||||
$(li).clearFormErrors();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
var textEdit = li.find('.text-edit');
|
||||
var controls = li.find('.controls .vis,.edit,.del');
|
||||
var controlsEdit = li.find('.controls .ok,.cancel');
|
||||
|
||||
// Toggle edit mode
|
||||
columnEditMode = true;
|
||||
li.addClass('editing');
|
||||
|
||||
// Set the text-edit's value
|
||||
textEdit.val(text.text().trim());
|
||||
|
||||
// Toggle elements
|
||||
text.hide();
|
||||
controls.hide();
|
||||
textEdit.css('display', ''); // show() doesn't work
|
||||
controlsEdit.css('display', ''); // show() doesn't work
|
||||
dropdownList.sortable('disable');
|
||||
dropdownList.on('click', function(ev) {
|
||||
ev.stopPropagation();
|
||||
});
|
||||
// Focus input
|
||||
textEdit.focus();
|
||||
});
|
||||
|
||||
// On hiding dropdown, cancel edit mode throughout dropdown
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class CustomFieldsController < ApplicationController
|
||||
include InputSanitizeHelper
|
||||
|
||||
before_action :load_vars, only: [:update, :destroy, :destroy_html]
|
||||
before_action :load_vars, except: :create
|
||||
before_action :load_vars_nested, only: [:create, :destroy_html]
|
||||
before_action :check_create_permissions, only: :create
|
||||
before_action :check_update_permissions, only: :update
|
||||
|
|
Loading…
Reference in a new issue