Skip to content

Commit e753b5e

Browse files
add confirmation dialog, style button
1 parent 6ecbaad commit e753b5e

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

language/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ H5PEditor.language.core = {
220220
newChangeHasBeenLogged: 'New change has been logged',
221221
loggedChanges: 'Logged changes',
222222
noChangesHaveBeenLogged: 'No changes have been logged',
223+
confirmCloseMetadataModal: 'Are you would like to close this modal? Any unsaved changes will be lost.',
223224
errorHeader: 'An error occured',
224225
errorCalculatingMaxScore: 'Could not calculate the max score for this content. The max score is assumed to be 0. Contact your administrator if this isn’t correct.',
225226
maxScoreSemanticsMissing: 'Could not find the expected semantics in the content.',

scripts/h5peditor-metadata.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ H5PEditor.MetadataForm = (function (EventDispatcher, $, metadataSemantics) {
8686
* @private
8787
*/
8888
const handleClose = function () {
89-
if (confirm(H5PEditor.t('core', 'confirmDeleteChangeLog'))) {
89+
// if changes have been made to the params object, display a confirmation
90+
if (JSON.stringify(params) !== JSON.stringify(paramsOnModalOpen)) {
91+
if (confirm(H5PEditor.t('core', 'confirmCloseMetadataModal'))) {
92+
resetMetadataForm();
93+
closePopup();
94+
}
95+
} else {
9096
resetMetadataForm();
9197
closePopup();
9298
}

styles/css/application.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

styles/scss/_metadata-form.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@
186186
background-color: #095345;
187187
}
188188

189+
.h5p-cancel {
190+
border-radius: 0.3rem;
191+
margin-left: 12px;
192+
padding: 0.75rem;
193+
}
194+
189195
.h5peditor-label {
190196
font-size: 0.8em;
191197
color: #333;

0 commit comments

Comments
 (0)