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');
|
// Only when the response is a Dialog, check if the user
|
||||||
if (form.length) {
|
// is quitting with pending changes
|
||||||
JX.DOM.listen(form[0], 'keydown', null, function(e) {
|
if (this._root) {
|
||||||
if (e.getSpecialKey()) {
|
var form = JX.DOM.scry(this._root, 'form', 'jx-dialog');
|
||||||
return;
|
if (form.length) {
|
||||||
}
|
JX.DOM.listen(form[0], 'keydown', null, function(e) {
|
||||||
JX.Stratcom.addSigil(form[0], 'dialog-keydown');
|
if (e.getSpecialKey()) {
|
||||||
});
|
return;
|
||||||
|
}
|
||||||
|
JX.Stratcom.addSigil(form[0], 'dialog-keydown');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_push : function() {
|
_push : function() {
|
||||||
|
@ -546,13 +550,20 @@ JX.install('Workflow', {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var form = JX.DOM.scry(active._root, 'form', 'jx-dialog');
|
// Only when the response is a Dialog, check if the user
|
||||||
if (
|
// is quitting with pending changes
|
||||||
form.length &&
|
if (active._root) {
|
||||||
JX.Stratcom.hasSigil(form[0], 'dialog-keydown') &&
|
var form = JX.DOM.scry(active._root, 'form', 'jx-dialog');
|
||||||
!confirm('Form data may have changed. Are you sure you want to close this dialog?')
|
var confirmMsg =
|
||||||
) {
|
'Form data may have changed. ' +
|
||||||
return;
|
'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();
|
JX.Workflow._pop();
|
||||||
|
|
Loading…
Reference in a new issue