mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Add a synthetic DOM event to JX.Workflow for form submission
Summary: Currently, when a dialog is submitted the Workflow itself emits an event but no DOM event is emitted. The workflow event is fine for handlers which only use JS, but there's currently no way for a handler to act more like a normal form handler. This event gives normal form handlers a way to capture Workflow submits and muck around with form contents, etc. Test Plan: In a future diff, edited policies via a Workflow dialog. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7295
This commit is contained in:
parent
181aff8556
commit
3f5a7b31c8
4 changed files with 77 additions and 69 deletions
|
@ -2295,7 +2295,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-policy-rule-editor' =>
|
||||
array(
|
||||
'uri' => '/res/4ae4249d/rsrc/js/application/policy/behavior-policy-rule-editor.js',
|
||||
'uri' => '/res/4665236c/rsrc/js/application/policy/behavior-policy-rule-editor.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -2497,7 +2497,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-workflow' =>
|
||||
array(
|
||||
'uri' => '/res/4a0595c1/rsrc/js/core/behavior-workflow.js',
|
||||
'uri' => '/res/144d3196/rsrc/js/core/behavior-workflow.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -2914,7 +2914,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-workflow' =>
|
||||
array(
|
||||
'uri' => '/res/7626494b/rsrc/externals/javelin/lib/Workflow.js',
|
||||
'uri' => '/res/09a97dda/rsrc/externals/javelin/lib/Workflow.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -4309,7 +4309,7 @@ celerity_register_resource_map(array(
|
|||
'uri' => '/res/pkg/0ed58ed4/core.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'9eabd244' =>
|
||||
'adee86d9' =>
|
||||
array(
|
||||
'name' => 'core.pkg.js',
|
||||
'symbols' =>
|
||||
|
@ -4354,7 +4354,7 @@ celerity_register_resource_map(array(
|
|||
37 => 'javelin-color',
|
||||
38 => 'javelin-fx',
|
||||
),
|
||||
'uri' => '/res/pkg/9eabd244/core.pkg.js',
|
||||
'uri' => '/res/pkg/adee86d9/core.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'4ccfeb47' =>
|
||||
|
@ -4441,7 +4441,7 @@ celerity_register_resource_map(array(
|
|||
'uri' => '/res/pkg/96909266/diffusion.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'9564fa17' =>
|
||||
'3e3be199' =>
|
||||
array(
|
||||
'name' => 'javelin.pkg.js',
|
||||
'symbols' =>
|
||||
|
@ -4467,7 +4467,7 @@ celerity_register_resource_map(array(
|
|||
18 => 'javelin-tokenizer',
|
||||
19 => 'javelin-history',
|
||||
),
|
||||
'uri' => '/res/pkg/9564fa17/javelin.pkg.js',
|
||||
'uri' => '/res/pkg/3e3be199/javelin.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
49898640 =>
|
||||
|
@ -4522,16 +4522,16 @@ celerity_register_resource_map(array(
|
|||
'diffusion-icons-css' => 'c8ce2d88',
|
||||
'global-drag-and-drop-css' => '0ed58ed4',
|
||||
'inline-comment-summary-css' => '4dc2311c',
|
||||
'javelin-aphlict' => '9eabd244',
|
||||
'javelin-behavior' => '9564fa17',
|
||||
'javelin-behavior-aphlict-dropdown' => '9eabd244',
|
||||
'javelin-behavior-aphlict-listen' => '9eabd244',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => '9eabd244',
|
||||
'javelin-aphlict' => 'adee86d9',
|
||||
'javelin-behavior' => '3e3be199',
|
||||
'javelin-behavior-aphlict-dropdown' => 'adee86d9',
|
||||
'javelin-behavior-aphlict-listen' => 'adee86d9',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => 'adee86d9',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '5e9e5c4e',
|
||||
'javelin-behavior-aphront-form-disable-on-submit' => '9eabd244',
|
||||
'javelin-behavior-aphront-form-disable-on-submit' => 'adee86d9',
|
||||
'javelin-behavior-audit-preview' => '96909266',
|
||||
'javelin-behavior-dark-console' => '4ccfeb47',
|
||||
'javelin-behavior-device' => '9eabd244',
|
||||
'javelin-behavior-device' => 'adee86d9',
|
||||
'javelin-behavior-differential-accept-with-errors' => '5e9e5c4e',
|
||||
'javelin-behavior-differential-add-reviewers-and-ccs' => '5e9e5c4e',
|
||||
'javelin-behavior-differential-comment-jump' => '5e9e5c4e',
|
||||
|
@ -4547,88 +4547,88 @@ celerity_register_resource_map(array(
|
|||
'javelin-behavior-diffusion-commit-graph' => '96909266',
|
||||
'javelin-behavior-diffusion-pull-lastmodified' => '96909266',
|
||||
'javelin-behavior-error-log' => '4ccfeb47',
|
||||
'javelin-behavior-global-drag-and-drop' => '9eabd244',
|
||||
'javelin-behavior-history-install' => '9eabd244',
|
||||
'javelin-behavior-konami' => '9eabd244',
|
||||
'javelin-behavior-lightbox-attachments' => '9eabd244',
|
||||
'javelin-behavior-global-drag-and-drop' => 'adee86d9',
|
||||
'javelin-behavior-history-install' => 'adee86d9',
|
||||
'javelin-behavior-konami' => 'adee86d9',
|
||||
'javelin-behavior-lightbox-attachments' => 'adee86d9',
|
||||
'javelin-behavior-load-blame' => '5e9e5c4e',
|
||||
'javelin-behavior-maniphest-batch-selector' => '0a694954',
|
||||
'javelin-behavior-maniphest-subpriority-editor' => '0a694954',
|
||||
'javelin-behavior-maniphest-transaction-controls' => '0a694954',
|
||||
'javelin-behavior-maniphest-transaction-expand' => '0a694954',
|
||||
'javelin-behavior-maniphest-transaction-preview' => '0a694954',
|
||||
'javelin-behavior-phabricator-active-nav' => '9eabd244',
|
||||
'javelin-behavior-phabricator-autofocus' => '9eabd244',
|
||||
'javelin-behavior-phabricator-gesture' => '9eabd244',
|
||||
'javelin-behavior-phabricator-hovercards' => '9eabd244',
|
||||
'javelin-behavior-phabricator-keyboard-shortcuts' => '9eabd244',
|
||||
'javelin-behavior-phabricator-nav' => '9eabd244',
|
||||
'javelin-behavior-phabricator-active-nav' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-autofocus' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-gesture' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-hovercards' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-keyboard-shortcuts' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-nav' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-object-selector' => '5e9e5c4e',
|
||||
'javelin-behavior-phabricator-oncopy' => '9eabd244',
|
||||
'javelin-behavior-phabricator-remarkup-assist' => '9eabd244',
|
||||
'javelin-behavior-phabricator-reveal-content' => '9eabd244',
|
||||
'javelin-behavior-phabricator-search-typeahead' => '9eabd244',
|
||||
'javelin-behavior-phabricator-tooltips' => '9eabd244',
|
||||
'javelin-behavior-phabricator-watch-anchor' => '9eabd244',
|
||||
'javelin-behavior-refresh-csrf' => '9eabd244',
|
||||
'javelin-behavior-phabricator-oncopy' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-remarkup-assist' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-reveal-content' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-search-typeahead' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-tooltips' => 'adee86d9',
|
||||
'javelin-behavior-phabricator-watch-anchor' => 'adee86d9',
|
||||
'javelin-behavior-refresh-csrf' => 'adee86d9',
|
||||
'javelin-behavior-repository-crossreference' => '5e9e5c4e',
|
||||
'javelin-behavior-toggle-class' => '9eabd244',
|
||||
'javelin-behavior-workflow' => '9eabd244',
|
||||
'javelin-color' => '9eabd244',
|
||||
'javelin-dom' => '9564fa17',
|
||||
'javelin-event' => '9564fa17',
|
||||
'javelin-fx' => '9eabd244',
|
||||
'javelin-history' => '9564fa17',
|
||||
'javelin-install' => '9564fa17',
|
||||
'javelin-json' => '9564fa17',
|
||||
'javelin-mask' => '9564fa17',
|
||||
'javelin-request' => '9564fa17',
|
||||
'javelin-resource' => '9564fa17',
|
||||
'javelin-stratcom' => '9564fa17',
|
||||
'javelin-tokenizer' => '9564fa17',
|
||||
'javelin-typeahead' => '9564fa17',
|
||||
'javelin-typeahead-normalizer' => '9564fa17',
|
||||
'javelin-typeahead-ondemand-source' => '9564fa17',
|
||||
'javelin-typeahead-preloaded-source' => '9564fa17',
|
||||
'javelin-typeahead-source' => '9564fa17',
|
||||
'javelin-uri' => '9564fa17',
|
||||
'javelin-util' => '9564fa17',
|
||||
'javelin-vector' => '9564fa17',
|
||||
'javelin-workflow' => '9564fa17',
|
||||
'javelin-behavior-toggle-class' => 'adee86d9',
|
||||
'javelin-behavior-workflow' => 'adee86d9',
|
||||
'javelin-color' => 'adee86d9',
|
||||
'javelin-dom' => '3e3be199',
|
||||
'javelin-event' => '3e3be199',
|
||||
'javelin-fx' => 'adee86d9',
|
||||
'javelin-history' => '3e3be199',
|
||||
'javelin-install' => '3e3be199',
|
||||
'javelin-json' => '3e3be199',
|
||||
'javelin-mask' => '3e3be199',
|
||||
'javelin-request' => '3e3be199',
|
||||
'javelin-resource' => '3e3be199',
|
||||
'javelin-stratcom' => '3e3be199',
|
||||
'javelin-tokenizer' => '3e3be199',
|
||||
'javelin-typeahead' => '3e3be199',
|
||||
'javelin-typeahead-normalizer' => '3e3be199',
|
||||
'javelin-typeahead-ondemand-source' => '3e3be199',
|
||||
'javelin-typeahead-preloaded-source' => '3e3be199',
|
||||
'javelin-typeahead-source' => '3e3be199',
|
||||
'javelin-uri' => '3e3be199',
|
||||
'javelin-util' => '3e3be199',
|
||||
'javelin-vector' => '3e3be199',
|
||||
'javelin-workflow' => '3e3be199',
|
||||
'lightbox-attachment-css' => '0ed58ed4',
|
||||
'maniphest-task-summary-css' => '49898640',
|
||||
'phabricator-action-list-view-css' => '0ed58ed4',
|
||||
'phabricator-application-launch-view-css' => '0ed58ed4',
|
||||
'phabricator-busy' => '9eabd244',
|
||||
'phabricator-busy' => 'adee86d9',
|
||||
'phabricator-content-source-view-css' => '4dc2311c',
|
||||
'phabricator-core-css' => '0ed58ed4',
|
||||
'phabricator-crumbs-view-css' => '0ed58ed4',
|
||||
'phabricator-drag-and-drop-file-upload' => '5e9e5c4e',
|
||||
'phabricator-dropdown-menu' => '9eabd244',
|
||||
'phabricator-file-upload' => '9eabd244',
|
||||
'phabricator-dropdown-menu' => 'adee86d9',
|
||||
'phabricator-file-upload' => 'adee86d9',
|
||||
'phabricator-filetree-view-css' => '0ed58ed4',
|
||||
'phabricator-flag-css' => '0ed58ed4',
|
||||
'phabricator-hovercard' => '9eabd244',
|
||||
'phabricator-hovercard' => 'adee86d9',
|
||||
'phabricator-jump-nav' => '0ed58ed4',
|
||||
'phabricator-keyboard-shortcut' => '9eabd244',
|
||||
'phabricator-keyboard-shortcut-manager' => '9eabd244',
|
||||
'phabricator-keyboard-shortcut' => 'adee86d9',
|
||||
'phabricator-keyboard-shortcut-manager' => 'adee86d9',
|
||||
'phabricator-main-menu-view' => '0ed58ed4',
|
||||
'phabricator-menu-item' => '9eabd244',
|
||||
'phabricator-menu-item' => 'adee86d9',
|
||||
'phabricator-nav-view-css' => '0ed58ed4',
|
||||
'phabricator-notification' => '9eabd244',
|
||||
'phabricator-notification' => 'adee86d9',
|
||||
'phabricator-notification-css' => '0ed58ed4',
|
||||
'phabricator-notification-menu-css' => '0ed58ed4',
|
||||
'phabricator-object-selector-css' => '4dc2311c',
|
||||
'phabricator-phtize' => '9eabd244',
|
||||
'phabricator-prefab' => '9eabd244',
|
||||
'phabricator-phtize' => 'adee86d9',
|
||||
'phabricator-prefab' => 'adee86d9',
|
||||
'phabricator-project-tag-css' => '49898640',
|
||||
'phabricator-remarkup-css' => '0ed58ed4',
|
||||
'phabricator-shaped-request' => '5e9e5c4e',
|
||||
'phabricator-side-menu-view-css' => '0ed58ed4',
|
||||
'phabricator-standard-page-view' => '0ed58ed4',
|
||||
'phabricator-tag-view-css' => '0ed58ed4',
|
||||
'phabricator-textareautils' => '9eabd244',
|
||||
'phabricator-tooltip' => '9eabd244',
|
||||
'phabricator-textareautils' => 'adee86d9',
|
||||
'phabricator-tooltip' => 'adee86d9',
|
||||
'phabricator-transaction-view-css' => '0ed58ed4',
|
||||
'phabricator-zindex-css' => '0ed58ed4',
|
||||
'phui-button-css' => '0ed58ed4',
|
||||
|
|
10
webroot/rsrc/externals/javelin/lib/Workflow.js
vendored
10
webroot/rsrc/externals/javelin/lib/Workflow.js
vendored
|
@ -88,6 +88,8 @@ JX.install('Workflow', {
|
|||
return;
|
||||
}
|
||||
|
||||
event.prevent();
|
||||
|
||||
// Get the button (which is sometimes actually another tag, like an <a />)
|
||||
// which triggered the event. In particular, this makes sure we get the
|
||||
// right node if there is a <button> with an <img /> inside it or
|
||||
|
@ -98,6 +100,13 @@ JX.install('Workflow', {
|
|||
JX.Workflow._pop();
|
||||
} else {
|
||||
var form = event.getNode('jx-dialog');
|
||||
|
||||
// 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([t.name, t.value || true]);
|
||||
|
@ -112,7 +121,6 @@ JX.install('Workflow', {
|
|||
.start();
|
||||
}
|
||||
}
|
||||
event.prevent();
|
||||
},
|
||||
_getActiveWorkflow : function() {
|
||||
var stack = JX.Workflow._stack;
|
||||
|
|
|
@ -42,7 +42,7 @@ JX.behavior('policy-rule-editor', function(config) {
|
|||
|
||||
JX.DOM.listen(
|
||||
JX.DOM.findAbove(root, 'form'),
|
||||
'submit',
|
||||
['submit', 'didWorkflowSubmit'],
|
||||
null,
|
||||
function(e) {
|
||||
var rules = JX.DOM.find(e.getNode('tag:form'), 'input', 'rules');
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
JX.behavior('workflow', function() {
|
||||
|
||||
// Listen for both real
|
||||
// Listen for both real and synthetic submit events.
|
||||
JX.Stratcom.listen(
|
||||
['submit', 'didSyntheticSubmit'],
|
||||
['workflow', 'tag:form'],
|
||||
|
|
Loading…
Reference in a new issue