mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-17 14:46:00 +08:00
80f66736b6
* Add new task modal for experiment table view [SCI-7448] * Fix placeholder and size of the icon [SCI-7448] * Reload experiment table [SCI-7448]
30 lines
974 B
JavaScript
30 lines
974 B
JavaScript
(function() {
|
|
function initNewMyModuleModal() {
|
|
let experimentWrapper = '.experiment-new-my_module';
|
|
let newMyModuleModal = '#new-my-module-modal';
|
|
|
|
// Modal's submit handler function
|
|
$(experimentWrapper)
|
|
.on('ajax:success', newMyModuleModal, function() {
|
|
$(newMyModuleModal).modal('hide');
|
|
})
|
|
.on('ajax:error', newMyModuleModal, function(ev, data) {
|
|
$(this).renderFormErrors('my_module', data.responseJSON);
|
|
});
|
|
|
|
$(experimentWrapper)
|
|
.on('ajax:success', '.new-my-module-button', function(ev, data) {
|
|
// Add and show modal
|
|
$(experimentWrapper).append($.parseHTML(data.html));
|
|
$(newMyModuleModal).modal('show');
|
|
$(newMyModuleModal).find("input[type='text']").focus();
|
|
|
|
// Remove modal when it gets closed
|
|
$(newMyModuleModal).on('hidden.bs.modal', function() {
|
|
$(newMyModuleModal).remove();
|
|
});
|
|
});
|
|
}
|
|
|
|
initNewMyModuleModal();
|
|
}());
|