mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Transactions - make ctrl + enter submit ajax-style
Summary: We were correctly invoked a didSyntheticSubmit event on the form, but nothing was listening to it. Re-jigger the workflow submit code a tad so an onsyntheticsubmit event handler can be written to fill this gap. Fixes T4669. Test Plan: edited comments, submitting both via clicking the button and apple + enter LIKE A BOSS Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T4669 Differential Revision: https://secure.phabricator.com/D8961
This commit is contained in:
parent
bfa8803287
commit
c995e93bc1
2 changed files with 50 additions and 32 deletions
|
@ -14,7 +14,7 @@ return array(
|
|||
'differential.pkg.js' => '11a5b750',
|
||||
'diffusion.pkg.css' => '3783278d',
|
||||
'diffusion.pkg.js' => '5b4010f4',
|
||||
'javelin.pkg.js' => '0452e69d',
|
||||
'javelin.pkg.js' => '9f6d38c7',
|
||||
'maniphest.pkg.css' => 'f1887d71',
|
||||
'maniphest.pkg.js' => '2fe8af22',
|
||||
'rsrc/css/aphront/aphront-bars.css' => '231ac33c',
|
||||
|
@ -208,7 +208,7 @@ return array(
|
|||
'rsrc/externals/javelin/lib/Resource.js' => '356de121',
|
||||
'rsrc/externals/javelin/lib/URI.js' => 'd9a9b862',
|
||||
'rsrc/externals/javelin/lib/Vector.js' => '039fb90d',
|
||||
'rsrc/externals/javelin/lib/Workflow.js' => 'f28bf201',
|
||||
'rsrc/externals/javelin/lib/Workflow.js' => 'ff8091f7',
|
||||
'rsrc/externals/javelin/lib/__tests__/Cookie.js' => '5ed109e8',
|
||||
'rsrc/externals/javelin/lib/__tests__/DOM.js' => 'c984504b',
|
||||
'rsrc/externals/javelin/lib/__tests__/JSON.js' => '2295d074',
|
||||
|
@ -668,7 +668,7 @@ return array(
|
|||
'javelin-view-interpreter' => '0c33c1a0',
|
||||
'javelin-view-renderer' => '6c2b09a2',
|
||||
'javelin-view-visitor' => 'efe49472',
|
||||
'javelin-workflow' => 'f28bf201',
|
||||
'javelin-workflow' => 'ff8091f7',
|
||||
'lightbox-attachment-css' => '7acac05d',
|
||||
'maniphest-batch-editor' => '8f380ebc',
|
||||
'maniphest-report-css' => '6fc16517',
|
||||
|
@ -1883,17 +1883,6 @@ return array(
|
|||
4 => 'javelin-request',
|
||||
5 => 'javelin-workflow',
|
||||
),
|
||||
'f28bf201' =>
|
||||
array(
|
||||
0 => 'javelin-stratcom',
|
||||
1 => 'javelin-request',
|
||||
2 => 'javelin-dom',
|
||||
3 => 'javelin-vector',
|
||||
4 => 'javelin-install',
|
||||
5 => 'javelin-util',
|
||||
6 => 'javelin-mask',
|
||||
7 => 'javelin-uri',
|
||||
),
|
||||
'f42bb8c6' =>
|
||||
array(
|
||||
0 => 'javelin-stratcom',
|
||||
|
@ -1985,6 +1974,17 @@ return array(
|
|||
2 => 'javelin-workflow',
|
||||
3 => 'javelin-dom',
|
||||
),
|
||||
'ff8091f7' =>
|
||||
array(
|
||||
0 => 'javelin-stratcom',
|
||||
1 => 'javelin-request',
|
||||
2 => 'javelin-dom',
|
||||
3 => 'javelin-vector',
|
||||
4 => 'javelin-install',
|
||||
5 => 'javelin-util',
|
||||
6 => 'javelin-mask',
|
||||
7 => 'javelin-uri',
|
||||
),
|
||||
28497740 =>
|
||||
array(
|
||||
0 => 'javelin-behavior',
|
||||
|
|
54
webroot/rsrc/externals/javelin/lib/Workflow.js
vendored
54
webroot/rsrc/externals/javelin/lib/Workflow.js
vendored
|
@ -107,26 +107,39 @@ JX.install('Workflow', {
|
|||
JX.Workflow._pop();
|
||||
} else {
|
||||
var form = event.getNode('jx-dialog');
|
||||
JX.Workflow._dosubmit(form, t);
|
||||
}
|
||||
},
|
||||
_onsyntheticsubmit : function(e) {
|
||||
if (JX.Stratcom.pass()) {
|
||||
return;
|
||||
}
|
||||
if (JX.Workflow._disabled) {
|
||||
return;
|
||||
}
|
||||
e.prevent();
|
||||
var form = e.getNode('jx-dialog');
|
||||
var button = JX.DOM.find(form, 'button', '__default__');
|
||||
JX.Workflow._dosubmit(form, button);
|
||||
},
|
||||
_dosubmit : function(form, button) {
|
||||
// Issue a DOM event first, so form-oriented handlers can act.
|
||||
var dom_event = JX.DOM.invoke(form, 'didWorkflowSubmit');
|
||||
if (dom_event.getPrevented()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Issue a DOM event first, so form-oriented handlers can act.
|
||||
var dom_event = JX.DOM.invoke(form, 'didWorkflowSubmit');
|
||||
if (dom_event.getPrevented()) {
|
||||
return;
|
||||
}
|
||||
var data = JX.DOM.convertFormToListOfPairs(form);
|
||||
data.push([button.name, button.value || true]);
|
||||
|
||||
var data = JX.DOM.convertFormToListOfPairs(form);
|
||||
|
||||
data.push([t.name, t.value || true]);
|
||||
|
||||
var active = JX.Workflow._getActiveWorkflow();
|
||||
var e = active.invoke('submit', {form: form, data: data});
|
||||
if (!e.getStopped()) {
|
||||
active._destroy();
|
||||
active
|
||||
.setURI(form.getAttribute('action') || active.getURI())
|
||||
.setDataWithListOfPairs(data)
|
||||
.start();
|
||||
}
|
||||
var active = JX.Workflow._getActiveWorkflow();
|
||||
var e = active.invoke('submit', {form: form, data: data});
|
||||
if (!e.getStopped()) {
|
||||
active._destroy();
|
||||
active
|
||||
.setURI(form.getAttribute('action') || active.getURI())
|
||||
.setDataWithListOfPairs(data)
|
||||
.start();
|
||||
}
|
||||
},
|
||||
_getActiveWorkflow : function() {
|
||||
|
@ -155,6 +168,11 @@ JX.install('Workflow', {
|
|||
'click',
|
||||
[['jx-workflow-button'], ['tag:button']],
|
||||
JX.Workflow._onbutton);
|
||||
JX.DOM.listen(
|
||||
this._root,
|
||||
'didSyntheticSubmit',
|
||||
[],
|
||||
JX.Workflow._onsyntheticsubmit);
|
||||
document.body.appendChild(this._root);
|
||||
var d = JX.Vector.getDim(this._root);
|
||||
var v = JX.Vector.getViewport();
|
||||
|
|
Loading…
Reference in a new issue