mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +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
41
webroot/rsrc/externals/javelin/lib/Workflow.js
vendored
41
webroot/rsrc/externals/javelin/lib/Workflow.js
vendored
|
@ -404,14 +404,18 @@ JX.install('Workflow', {
|
|||
}
|
||||
}
|
||||
|
||||
var form = JX.DOM.scry(this._root, 'form', 'jx-dialog');
|
||||
if (form.length) {
|
||||
JX.DOM.listen(form[0], 'keydown', null, function(e) {
|
||||
if (e.getSpecialKey()) {
|
||||
return;
|
||||
}
|
||||
JX.Stratcom.addSigil(form[0], 'dialog-keydown');
|
||||
});
|
||||
// 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) {
|
||||
if (e.getSpecialKey()) {
|
||||
return;
|
||||
}
|
||||
JX.Stratcom.addSigil(form[0], 'dialog-keydown');
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
_push : function() {
|
||||
|
@ -546,13 +550,20 @@ JX.install('Workflow', {
|
|||
return;
|
||||
}
|
||||
|
||||
var form = JX.DOM.scry(active._root, 'form', 'jx-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?')
|
||||
) {
|
||||
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') &&
|
||||
!window.confirm(confirmMsg)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
JX.Workflow._pop();
|
||||
|
|
Loading…
Reference in a new issue