mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-12 12:16:06 +08:00
58782131a8
Add redirect flash message after draft delete and before the location redirect [SCI-8245]
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
/* global HelperModule */
|
|
|
|
import TurbolinksAdapter from 'vue-turbolinks';
|
|
import Vue from 'vue/dist/vue.esm';
|
|
import ProtocolContainer from '../../vue/protocol/container.vue';
|
|
|
|
Vue.use(TurbolinksAdapter);
|
|
Vue.prototype.i18n = window.I18n;
|
|
Vue.prototype.inlineEditing = window.inlineEditing;
|
|
Vue.prototype.ActiveStoragePreviews = window.ActiveStoragePreviews;
|
|
|
|
window.initProtocolComponent = () => {
|
|
Vue.prototype.dateFormat = $('#protocolContainer').data('date-format');
|
|
|
|
$('.protocols-show').on('click', '#protocol-versions-modal .delete-draft', (e) => {
|
|
const url = e.currentTarget.dataset.url;
|
|
const modal = $('#deleteDraftModal');
|
|
$('#protocol-versions-modal').modal('hide');
|
|
modal.modal('show');
|
|
modal.find('form').attr('action', url);
|
|
});
|
|
|
|
$('#deleteDraftModal form').on('ajax:error', function(_ev, data) {
|
|
HelperModule.flashAlertMsg(data.responseJSON.message, 'danger');
|
|
});
|
|
|
|
new Vue({
|
|
el: '#protocolContainer',
|
|
components: {
|
|
'protocol-container': ProtocolContainer
|
|
},
|
|
data() {
|
|
return {
|
|
protocolUrl: $('#protocolContainer').data('protocol-url')
|
|
};
|
|
}
|
|
});
|
|
};
|
|
|
|
initProtocolComponent();
|