mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-14 05:05:55 +08:00
dfa79c6996
Co-authored-by: Anton <anton@scinote.net>
32 lines
954 B
JavaScript
32 lines
954 B
JavaScript
/* global animateSpinner */
|
|
(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 }) {
|
|
$(modal)
|
|
.on('shown.bs.modal', function() {
|
|
if ($(this).hasClass('project-assignments-modal')) {
|
|
$(this).on('ajax:success', 'form', function() {
|
|
ProjectsIndex.loadCardsView();
|
|
});
|
|
}
|
|
$(this).find('.selectpicker').selectpicker();
|
|
})
|
|
.on('hidden.bs.modal', function() {
|
|
$(this).remove();
|
|
})
|
|
.modal('show');
|
|
animateSpinner(null, false);
|
|
});
|
|
});
|
|
}
|
|
|
|
$(document).one('turbolinks:load', initRemoteModalListeners);
|
|
}());
|