mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-06 15:05:26 +08:00
Merge pull request #163 from ZmagoD/zd_SCI_467
fixes edit modal [fixes SCI-467]
This commit is contained in:
commit
e1cf66f02a
1 changed files with 31 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
});
|
});
|
||||||
validateMoveModal(id);
|
validateMoveModal(id);
|
||||||
clearModal($(id));
|
clearModal($(id));
|
||||||
|
validateExperimentForm($(id));
|
||||||
})
|
})
|
||||||
.on("ajax:error", function() {
|
.on("ajax:error", function() {
|
||||||
animateSpinner(null, false);
|
animateSpinner(null, false);
|
||||||
|
@ -73,6 +74,36 @@
|
||||||
.clearFormErrors();
|
.clearFormErrors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Reload after successfully updated experiment
|
||||||
|
function validateExperimentForm(element){
|
||||||
|
if ( element ) {
|
||||||
|
var form = element.find("form");
|
||||||
|
form
|
||||||
|
.on('ajax:success' , function(){
|
||||||
|
animateSpinner(form, true);
|
||||||
|
location.reload();
|
||||||
|
})
|
||||||
|
.on('ajax:error', function(e, error){
|
||||||
|
var msg = JSON.parse(error.responseText);
|
||||||
|
if ( 'name' in msg ) {
|
||||||
|
renderFormError(e,
|
||||||
|
element.find("#experiment-name"),
|
||||||
|
msg.name.toString(),
|
||||||
|
true);
|
||||||
|
} else if ( 'description' in msg ) {
|
||||||
|
renderFormError(e,
|
||||||
|
element.find("#experiment-description"),
|
||||||
|
msg.description.toString(),
|
||||||
|
true);
|
||||||
|
} else {
|
||||||
|
renderFormError(e,
|
||||||
|
element.find("#experiment-name"),
|
||||||
|
error.statusText,
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
// Initialize no description edit link
|
// Initialize no description edit link
|
||||||
function initEditNoDescription(){
|
function initEditNoDescription(){
|
||||||
var modal = "#edit-experiment-modal-";
|
var modal = "#edit-experiment-modal-";
|
||||||
|
|
Loading…
Reference in a new issue