-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-28567: As an editor I want to be able to restore archived Content…
… version (#201)
- Loading branch information
Showing
5 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/bundle/Resources/public/js/scripts/admin.location.version.restore_archived.js
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,24 @@ | ||
(function (global, doc) { | ||
const FORM_ARCHIVED_VERSION_RESTORE = 'form[name="archived_version_restore"]'; | ||
const restoreArchivedVersion = (event) => { | ||
const versionRestoreForm = doc.querySelector(FORM_ARCHIVED_VERSION_RESTORE); | ||
const contentId = event.currentTarget.dataset.contentId; | ||
const versionNo = event.currentTarget.dataset.versionNo; | ||
const languageCode = event.currentTarget.dataset.languageCode; | ||
const contentInfoInput = versionRestoreForm.querySelector('input[name="archived_version_restore[content_info]"]'); | ||
const versionInfoContentInfoInput = versionRestoreForm.querySelector('input[name="archived_version_restore[version_info][content_info]"]'); | ||
const versionInfoVersionNoInput = versionRestoreForm.querySelector('input[name="archived_version_restore[version_info][version_no]"]'); | ||
const languageInput = versionRestoreForm.querySelector('#archived_version_restore_language_' + languageCode); | ||
|
||
event.preventDefault(); | ||
|
||
contentInfoInput.value = contentId; | ||
versionInfoContentInfoInput.value = contentId; | ||
versionInfoVersionNoInput.value = versionNo; | ||
languageInput.setAttribute('checked', true); | ||
|
||
versionRestoreForm.submit(); | ||
}; | ||
|
||
[...doc.querySelectorAll('.ez-btn--restore-archived-version')].forEach(button => button.addEventListener('click', restoreArchivedVersion, false)); | ||
})(window, document); |
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
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