mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-16 14:17:00 +08:00
46fc3d17e6
* Fix share_modal js loading [SCI-8548] Co-authored-by: Sboursen <dev.sboursen@gmail.com> * Fix hound [SCI-8548] Co-authored-by: Sboursen <dev.sboursen@gmail.com> * Fix hound [SCI-8548] Co-authored-by: Sboursen <dev.sboursen@gmail.com> --------- Co-authored-by: Sboursen <dev.sboursen@gmail.com>
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
/* global animateSpinner ProtocolsIndex ProjectsIndex ShareModal */
|
|
(function() {
|
|
'use strict';
|
|
|
|
function initRemoteModalListeners() {
|
|
$(document).on('click', 'a[data-action="remote-modal"]', function(ev) {
|
|
ev.stopImmediatePropagation();
|
|
ev.stopPropagation();
|
|
ev.preventDefault();
|
|
|
|
animateSpinner();
|
|
$.get(ev.currentTarget.getAttribute('href')).then(function({ modal, html }) {
|
|
$(modal || html)
|
|
.on('shown.bs.modal', function() {
|
|
if ($(this).hasClass('project-assignments-modal')) {
|
|
$(this).on('ajax:success', 'form', function() {
|
|
ProjectsIndex.loadCardsView();
|
|
});
|
|
}
|
|
if ($(this).hasClass('protocol-assignments-modal')) {
|
|
$(this).on('ajax:success', 'form', function() {
|
|
ProtocolsIndex.reloadTable();
|
|
});
|
|
}
|
|
if ($(this).hasClass('share-repo-modal')) {
|
|
animateSpinner(null, false);
|
|
ShareModal.init();
|
|
}
|
|
$(this).find('.selectpicker').selectpicker();
|
|
})
|
|
.on('hidden.bs.modal', function() {
|
|
$(this).remove();
|
|
})
|
|
.modal('show');
|
|
animateSpinner(null, false);
|
|
});
|
|
});
|
|
}
|
|
|
|
$(document).one('turbolinks:load', initRemoteModalListeners);
|
|
}());
|