-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Missing confirm warning from publish/unpublish (#71)
* Ensure legacy edit form JS included from versioned-admin This legacy JS file provide the functionality to display popup warning before publish or unpublish data object, such as, not inline elemental block. * Build JS assets for commit PR/71
- Loading branch information
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import i18n from 'i18n'; | ||
import jQuery from 'jquery'; | ||
|
||
jQuery.entwine('ss', ($) => { | ||
/** | ||
* Class: .cms-edit-form .btn-toolbar #Form_ItemEditForm_action_doUnpublish | ||
* Informing the user about the unpublish action while requiring confirmation | ||
*/ | ||
$('.cms-edit-form .btn-toolbar #Form_ItemEditForm_action_doUnpublish').entwine({ | ||
|
||
/** | ||
* Function: onclick | ||
* | ||
* Parameters: | ||
* (Event) e | ||
*/ | ||
onclick(e) { | ||
const message = i18n._t( | ||
'VersionedEditForm.PUBLISH_CONFIRM_MESSAGE', | ||
'Are you sure you want to remove your record from the published site?\n\nThis record will still be available in the CMS as draft.' | ||
); | ||
|
||
if (confirm(message)) { | ||
// Add a loading indicator and continue | ||
this.parents('form:first').addClass('loading'); | ||
|
||
return this._super(e); | ||
} | ||
|
||
return false; | ||
} | ||
}); | ||
|
||
/** | ||
* Class: .cms-edit-form .btn-toolbar #Form_ItemEditForm_action_doArchive | ||
* | ||
* Informing the user about the archive action while requiring confirmation | ||
*/ | ||
$('.cms-edit-form .btn-toolbar #Form_ItemEditForm_action_doArchive').entwine({ | ||
/** | ||
* Function: onclick | ||
* | ||
* Parameters: | ||
* (Event) e | ||
*/ | ||
onclick(e) { | ||
const message = i18n._t( | ||
'VersionedEditForm.ARCHIVE_CONFIRM_MESSAGE', | ||
'Warning: This record will be unpublished before being sent to the archive.\n\nAre you sure you want to proceed?' | ||
); | ||
|
||
if (confirm(message)) { | ||
// Add a loading indicator and continue | ||
this.parents('form:first').addClass('loading'); | ||
|
||
return this._super(e); | ||
} | ||
|
||
return false; | ||
} | ||
}); | ||
}); |