Skip to content

Commit

Permalink
pkp/pkp-lib#8350 Allow author to cancel submission
Browse files Browse the repository at this point in the history
  • Loading branch information
taslangraham committed Jan 9, 2025
1 parent 4fe6ad4 commit f080989
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/components/Container/SubmissionWizardPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export default {
i18nUnsavedChanges: '',
/** **Required** A localized string for the message of the dialog that appears when unsaved changes are found in local storage. */
i18nUnsavedChangesMessage: '',
/** The URL to the REST API endpoint to cancel this submission. */
submissionCancelApiUrl: '',
/** The URL to the page to display after a submission is cancelled. */
submissionCancelledUrl: '',
};
},
computed: {
Expand Down Expand Up @@ -782,6 +786,52 @@ export default {
});
}, 500);
},
/**
* Cancel a submission.
*/
cancelSubmission(){
this.openDialog({
name: 'SubmissionCancel',
title: this.t('submission.wizard.submissionCancel'),
message: this.t('submission.wizard.cancel.confirmation'),
actions: [
{
label: this.t('common.ok'),
isPrimary: true,
callback: (close) => {
$.ajax({
url: this.submissionCancelApiUrl,
context: this,
method: 'POST',
headers: {
'X-Csrf-Token': pkp.currentUser.csrfToken,
'X-Http-Method-Override': 'DELETE',
},
error(r) {
close();
if (!r.responseJSON) {
this.ajaxErrorCallback({});
} else {
this.errors = r.responseJSON;
}
},
success() {
window.location = this.submissionCancelledUrl;
},
});
},
},
{
label: this.t('common.cancel'),
isWarnable: true,
callback: (close) => close(),
},
],
modalStyle: 'negative',
});
}
},
};
</script>
Expand Down

0 comments on commit f080989

Please sign in to comment.