kopia lustrzana https://github.com/wagtail/wagtail
Revert "Fix workflow action buttons initialisation in footer actions"
This reverts commit fa267c9b1a
.
pull/12160/head
rodzic
bbb083a183
commit
8da32170c2
|
@ -1,45 +1,37 @@
|
|||
<script>
|
||||
$(function() {
|
||||
document.querySelectorAll('footer [data-controller="w-dropdown"]').forEach((e) => {
|
||||
e.addEventListener(
|
||||
'w-dropdown:shown',
|
||||
() => {
|
||||
ActivateWorkflowActionsForEditView('[data-edit-form]');
|
||||
ActivateWorkflowActionsForEditView('[data-edit-form]');
|
||||
|
||||
{% if publishing_will_cancel_workflow %}
|
||||
/* Make user confirm before publishing the object if it will cancel an ongoing workflow */
|
||||
let cancellationConfirmed = false;
|
||||
$('[name=action-publish]').click((e) => {
|
||||
if (!cancellationConfirmed) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
ModalWorkflow({
|
||||
'url': "{{ confirm_workflow_cancellation_url }}",
|
||||
'onload': {
|
||||
'confirm': function(modal, jsonData) {
|
||||
$('[data-confirm-cancellation]', modal.body).click((event) => {
|
||||
cancellationConfirmed = true;
|
||||
modal.close();
|
||||
e.currentTarget.click();
|
||||
})
|
||||
$('[data-cancel-dialog]', modal.body).click((event) => {
|
||||
modal.close();
|
||||
})
|
||||
},
|
||||
'no_confirmation_needed': function(modal, jsonData) {
|
||||
modal.close();
|
||||
cancellationConfirmed = true;
|
||||
e.currentTarget.click();
|
||||
}
|
||||
},
|
||||
'triggerElement': e.currentTarget,
|
||||
});
|
||||
{% if publishing_will_cancel_workflow %}
|
||||
/* Make user confirm before publishing the object if it will cancel an ongoing workflow */
|
||||
let cancellationConfirmed = false;
|
||||
$('[name=action-publish]').click((e) => {
|
||||
if (!cancellationConfirmed) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
ModalWorkflow({
|
||||
'url': "{{ confirm_workflow_cancellation_url }}",
|
||||
'onload': {
|
||||
'confirm': function(modal, jsonData) {
|
||||
$('[data-confirm-cancellation]', modal.body).click((event) => {
|
||||
cancellationConfirmed = true;
|
||||
modal.close();
|
||||
e.currentTarget.click();
|
||||
})
|
||||
$('[data-cancel-dialog]', modal.body).click((event) => {
|
||||
modal.close();
|
||||
})
|
||||
},
|
||||
'no_confirmation_needed': function(modal, jsonData) {
|
||||
modal.close();
|
||||
cancellationConfirmed = true;
|
||||
e.currentTarget.click();
|
||||
}
|
||||
});
|
||||
{% endif %}
|
||||
},
|
||||
{ once: true }
|
||||
)
|
||||
});
|
||||
},
|
||||
'triggerElement': e.currentTarget,
|
||||
});
|
||||
}
|
||||
});
|
||||
{% endif %}
|
||||
});
|
||||
</script>
|
||||
|
|
Ładowanie…
Reference in New Issue