mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
Fix regression in new confirmation Dialog
Summary: Fix a JavaScript regression encapsulating the problematic part into an `if`. Other minor changes: - dedicate a variable for the confirmation messages to improve i18n in the future (but also to avoid 80 characters and make lint happy) - replace `confirm` with `window.confirm` (to make lint happy) Ref T15034 Ref D25015 Test Plan: - surf on your local Phorge - no JavaScript errors in console Reviewers: bekay, Ekubischta, O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: speck, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15034 Differential Revision: https://we.phorge.it/D25076
This commit is contained in:
parent
9623e66745
commit
3487ee444a
1 changed files with 26 additions and 15 deletions
13
webroot/rsrc/externals/javelin/lib/Workflow.js
vendored
13
webroot/rsrc/externals/javelin/lib/Workflow.js
vendored
|
@ -404,6 +404,9 @@ JX.install('Workflow', {
|
|||
}
|
||||
}
|
||||
|
||||
// Only when the response is a Dialog, check if the user
|
||||
// is quitting with pending changes
|
||||
if (this._root) {
|
||||
var form = JX.DOM.scry(this._root, 'form', 'jx-dialog');
|
||||
if (form.length) {
|
||||
JX.DOM.listen(form[0], 'keydown', null, function(e) {
|
||||
|
@ -413,6 +416,7 @@ JX.install('Workflow', {
|
|||
JX.Stratcom.addSigil(form[0], 'dialog-keydown');
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
_push : function() {
|
||||
if (!this._pushed) {
|
||||
|
@ -546,14 +550,21 @@ JX.install('Workflow', {
|
|||
return;
|
||||
}
|
||||
|
||||
// Only when the response is a Dialog, check if the user
|
||||
// is quitting with pending changes
|
||||
if (active._root) {
|
||||
var form = JX.DOM.scry(active._root, 'form', 'jx-dialog');
|
||||
var confirmMsg =
|
||||
'Form data may have changed. ' +
|
||||
'Are you sure you want to close this dialog?';
|
||||
if (
|
||||
form.length &&
|
||||
JX.Stratcom.hasSigil(form[0], 'dialog-keydown') &&
|
||||
!confirm('Form data may have changed. Are you sure you want to close this dialog?')
|
||||
!window.confirm(confirmMsg)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
JX.Workflow._pop();
|
||||
e.prevent();
|
||||
|
|
Loading…
Reference in a new issue