1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Don't bring up multiple help dialogs when the user hits "?" multiple times

Summary:
Some day, maybe close the existing dialog too but there's no public method on
JX.Workflow for that right now.

Test Plan:
Hit "??????", then "esc", got back to the page instead of just popping a deep
stack.

Reviewed By: tomo
Reviewers: tomo
CC: aran, tomo
Differential Revision: 450
This commit is contained in:
epriestley 2011-06-13 10:26:58 -07:00
parent 501c001520
commit 33e6229969
2 changed files with 22 additions and 12 deletions

View file

@ -613,7 +613,7 @@ celerity_register_resource_map(array(
), ),
'javelin-behavior-phabricator-keyboard-shortcuts' => 'javelin-behavior-phabricator-keyboard-shortcuts' =>
array( array(
'uri' => '/res/5a23bcc8/rsrc/js/application/core/behavior-keyboard-shortcuts.js', 'uri' => '/res/7aed0604/rsrc/js/application/core/behavior-keyboard-shortcuts.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -1173,7 +1173,7 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/2892314d/typeahead.pkg.js', 'uri' => '/res/pkg/2892314d/typeahead.pkg.js',
'type' => 'js', 'type' => 'js',
), ),
'c8f4dac5' => '861d7db0' =>
array ( array (
'name' => 'workflow.pkg.js', 'name' => 'workflow.pkg.js',
'symbols' => 'symbols' =>
@ -1186,7 +1186,7 @@ celerity_register_resource_map(array(
5 => 'phabricator-keyboard-shortcut', 5 => 'phabricator-keyboard-shortcut',
6 => 'javelin-behavior-phabricator-keyboard-shortcuts', 6 => 'javelin-behavior-phabricator-keyboard-shortcuts',
), ),
'uri' => '/res/pkg/c8f4dac5/workflow.pkg.js', 'uri' => '/res/pkg/861d7db0/workflow.pkg.js',
'type' => 'js', 'type' => 'js',
), ),
'da416e1c' => 'da416e1c' =>
@ -1245,19 +1245,19 @@ celerity_register_resource_map(array(
'diffusion-commit-view-css' => '03ef179e', 'diffusion-commit-view-css' => '03ef179e',
'javelin-behavior' => 'db95a6d0', 'javelin-behavior' => 'db95a6d0',
'javelin-behavior-aphront-basic-tokenizer' => '2892314d', 'javelin-behavior-aphront-basic-tokenizer' => '2892314d',
'javelin-behavior-aphront-form-disable-on-submit' => 'c8f4dac5', 'javelin-behavior-aphront-form-disable-on-submit' => '861d7db0',
'javelin-behavior-differential-diff-radios' => 'da416e1c', 'javelin-behavior-differential-diff-radios' => 'da416e1c',
'javelin-behavior-differential-edit-inline-comments' => 'da416e1c', 'javelin-behavior-differential-edit-inline-comments' => 'da416e1c',
'javelin-behavior-differential-feedback-preview' => 'da416e1c', 'javelin-behavior-differential-feedback-preview' => 'da416e1c',
'javelin-behavior-differential-populate' => 'da416e1c', 'javelin-behavior-differential-populate' => 'da416e1c',
'javelin-behavior-differential-show-more' => 'da416e1c', 'javelin-behavior-differential-show-more' => 'da416e1c',
'javelin-behavior-phabricator-keyboard-shortcuts' => 'c8f4dac5', 'javelin-behavior-phabricator-keyboard-shortcuts' => '861d7db0',
'javelin-behavior-workflow' => 'c8f4dac5', 'javelin-behavior-workflow' => '861d7db0',
'javelin-dom' => 'db95a6d0', 'javelin-dom' => 'db95a6d0',
'javelin-event' => 'db95a6d0', 'javelin-event' => 'db95a6d0',
'javelin-install' => 'db95a6d0', 'javelin-install' => 'db95a6d0',
'javelin-json' => 'db95a6d0', 'javelin-json' => 'db95a6d0',
'javelin-mask' => 'c8f4dac5', 'javelin-mask' => '861d7db0',
'javelin-request' => 'db95a6d0', 'javelin-request' => 'db95a6d0',
'javelin-stratcom' => 'db95a6d0', 'javelin-stratcom' => 'db95a6d0',
'javelin-tokenizer' => '2892314d', 'javelin-tokenizer' => '2892314d',
@ -1269,12 +1269,12 @@ celerity_register_resource_map(array(
'javelin-uri' => 'db95a6d0', 'javelin-uri' => 'db95a6d0',
'javelin-util' => 'db95a6d0', 'javelin-util' => 'db95a6d0',
'javelin-vector' => 'db95a6d0', 'javelin-vector' => 'db95a6d0',
'javelin-workflow' => 'c8f4dac5', 'javelin-workflow' => '861d7db0',
'phabricator-core-buttons-css' => '01052905', 'phabricator-core-buttons-css' => '01052905',
'phabricator-core-css' => '01052905', 'phabricator-core-css' => '01052905',
'phabricator-directory-css' => '01052905', 'phabricator-directory-css' => '01052905',
'phabricator-keyboard-shortcut' => 'c8f4dac5', 'phabricator-keyboard-shortcut' => '861d7db0',
'phabricator-keyboard-shortcut-manager' => 'c8f4dac5', 'phabricator-keyboard-shortcut-manager' => '861d7db0',
'phabricator-remarkup-css' => '01052905', 'phabricator-remarkup-css' => '01052905',
'phabricator-standard-page-view' => '01052905', 'phabricator-standard-page-view' => '01052905',
'syntax-highlighting-css' => '01052905', 'syntax-highlighting-css' => '01052905',

View file

@ -10,12 +10,22 @@
* Define global keyboard shortcuts. * Define global keyboard shortcuts.
*/ */
JX.behavior('phabricator-keyboard-shortcuts', function(config) { JX.behavior('phabricator-keyboard-shortcuts', function(config) {
var workflow = null;
var desc = 'Show keyboard shortcut help for the current page.'; var desc = 'Show keyboard shortcut help for the current page.';
new JX.KeyboardShortcut('?', desc) new JX.KeyboardShortcut('?', desc)
.setHandler(function(manager) { .setHandler(function(manager) {
if (workflow) {
// Already showing the dialog.
return;
}
var desc = manager.getShortcutDescriptions(); var desc = manager.getShortcutDescriptions();
new JX.Workflow(config.helpURI, {keys : JX.JSON.serialize(desc)}) var data = {keys : JX.JSON.serialize(desc)};
.start(); workflow = new JX.Workflow(config.helpURI, data)
.setCloseHandler(function() {
workflow = null;
});
workflow.start();
}) })
.register(); .register();
}); });