From 81fc0b8843575c0355775710ecfb56165331502c Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 18 Mar 2012 19:44:28 -0700 Subject: [PATCH] Add keyboard navigation to Diffusion / Audit Summary: This diff is really complicated, only a master programmer like myself could have accomplished it. Test Plan: derrrrrp Reviewers: davidreuss, nh, btrahan, jungejason Reviewed By: jungejason CC: aran, epriestley Maniphest Tasks: T904 Differential Revision: https://secure.phabricator.com/D1936 --- src/__celerity_resource_map__.php | 42 +++++++++---------- .../commit/DiffusionCommitController.php | 7 ++++ .../differential/behavior-keyboard-nav.js | 9 ++-- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 93cf2d638f..4fd0e0dc7a 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -572,7 +572,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-differential-keyboard-navigation' => array( - 'uri' => '/res/f5ce5987/rsrc/js/application/differential/behavior-keyboard-nav.js', + 'uri' => '/res/d9755787/rsrc/js/application/differential/behavior-keyboard-nav.js', 'type' => 'js', 'requires' => array( @@ -841,7 +841,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-phabricator-oncopy' => array( - 'uri' => '/res/70b9b75e/rsrc/js/application/core/behavior-oncopy.js', + 'uri' => '/res/6aa56092/rsrc/js/application/core/behavior-oncopy.js', 'type' => 'js', 'requires' => array( @@ -2024,7 +2024,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/1cb6883c/differential.pkg.css', 'type' => 'css', ), - '31d4b993' => + 'c42635d2' => array( 'name' => 'differential.pkg.js', 'symbols' => @@ -2047,7 +2047,7 @@ celerity_register_resource_map(array( 15 => 'javelin-behavior-differential-dropdown-menus', 16 => 'javelin-behavior-buoyant', ), - 'uri' => '/res/pkg/31d4b993/differential.pkg.js', + 'uri' => '/res/pkg/c42635d2/differential.pkg.js', 'type' => 'js', ), '61f9d480' => @@ -2138,7 +2138,7 @@ celerity_register_resource_map(array( 'aphront-typeahead-control-css' => '78e8854e', 'differential-changeset-view-css' => '1cb6883c', 'differential-core-view-css' => '1cb6883c', - 'differential-inline-comment-editor' => '31d4b993', + 'differential-inline-comment-editor' => 'c42635d2', 'differential-local-commits-view-css' => '1cb6883c', 'differential-revision-add-comment-css' => '1cb6883c', 'differential-revision-comment-css' => '1cb6883c', @@ -2149,27 +2149,27 @@ celerity_register_resource_map(array( 'diffusion-commit-view-css' => '61f9d480', 'javelin-behavior' => '4fbae2af', 'javelin-behavior-aphront-basic-tokenizer' => '2af849fb', - 'javelin-behavior-aphront-drag-and-drop' => '31d4b993', - 'javelin-behavior-aphront-drag-and-drop-textarea' => '31d4b993', + 'javelin-behavior-aphront-drag-and-drop' => 'c42635d2', + 'javelin-behavior-aphront-drag-and-drop-textarea' => 'c42635d2', 'javelin-behavior-aphront-form-disable-on-submit' => 'c18634d0', - 'javelin-behavior-buoyant' => '31d4b993', - 'javelin-behavior-differential-accept-with-errors' => '31d4b993', - 'javelin-behavior-differential-add-reviewers-and-ccs' => '31d4b993', - 'javelin-behavior-differential-comment-jump' => '31d4b993', - 'javelin-behavior-differential-diff-radios' => '31d4b993', - 'javelin-behavior-differential-dropdown-menus' => '31d4b993', - 'javelin-behavior-differential-edit-inline-comments' => '31d4b993', - 'javelin-behavior-differential-feedback-preview' => '31d4b993', - 'javelin-behavior-differential-keyboard-navigation' => '31d4b993', - 'javelin-behavior-differential-populate' => '31d4b993', - 'javelin-behavior-differential-show-more' => '31d4b993', + 'javelin-behavior-buoyant' => 'c42635d2', + 'javelin-behavior-differential-accept-with-errors' => 'c42635d2', + 'javelin-behavior-differential-add-reviewers-and-ccs' => 'c42635d2', + 'javelin-behavior-differential-comment-jump' => 'c42635d2', + 'javelin-behavior-differential-diff-radios' => 'c42635d2', + 'javelin-behavior-differential-dropdown-menus' => 'c42635d2', + 'javelin-behavior-differential-edit-inline-comments' => 'c42635d2', + 'javelin-behavior-differential-feedback-preview' => 'c42635d2', + 'javelin-behavior-differential-keyboard-navigation' => 'c42635d2', + 'javelin-behavior-differential-populate' => 'c42635d2', + 'javelin-behavior-differential-show-more' => 'c42635d2', 'javelin-behavior-maniphest-batch-selector' => '86fc0b0c', 'javelin-behavior-maniphest-transaction-controls' => '86fc0b0c', 'javelin-behavior-maniphest-transaction-expand' => '86fc0b0c', 'javelin-behavior-maniphest-transaction-preview' => '86fc0b0c', 'javelin-behavior-phabricator-autofocus' => 'c18634d0', 'javelin-behavior-phabricator-keyboard-shortcuts' => 'c18634d0', - 'javelin-behavior-phabricator-object-selector' => '31d4b993', + 'javelin-behavior-phabricator-object-selector' => 'c42635d2', 'javelin-behavior-phabricator-watch-anchor' => 'c18634d0', 'javelin-behavior-refresh-csrf' => 'c18634d0', 'javelin-behavior-workflow' => 'c18634d0', @@ -2198,7 +2198,7 @@ celerity_register_resource_map(array( 'phabricator-core-buttons-css' => '78e8854e', 'phabricator-core-css' => '78e8854e', 'phabricator-directory-css' => '78e8854e', - 'phabricator-drag-and-drop-file-upload' => '31d4b993', + 'phabricator-drag-and-drop-file-upload' => 'c42635d2', 'phabricator-dropdown-menu' => 'c18634d0', 'phabricator-jump-nav' => '78e8854e', 'phabricator-keyboard-shortcut' => 'c18634d0', @@ -2207,7 +2207,7 @@ celerity_register_resource_map(array( 'phabricator-object-selector-css' => '1cb6883c', 'phabricator-paste-file-upload' => 'c18634d0', 'phabricator-remarkup-css' => '78e8854e', - 'phabricator-shaped-request' => '31d4b993', + 'phabricator-shaped-request' => 'c42635d2', 'phabricator-standard-page-view' => '78e8854e', 'phabricator-transaction-view-css' => '78e8854e', 'syntax-highlighting-css' => '78e8854e', diff --git a/src/applications/diffusion/controller/commit/DiffusionCommitController.php b/src/applications/diffusion/controller/commit/DiffusionCommitController.php index 6f8942f487..de35431294 100644 --- a/src/applications/diffusion/controller/commit/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/commit/DiffusionCommitController.php @@ -359,6 +359,13 @@ final class DiffusionCommitController extends DiffusionController { $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); + Javelin::initBehavior( + 'differential-keyboard-navigation', + array( + // TODO: Make this comment panel hauntable + 'haunt' => null, + )); + $draft = id(new PhabricatorDraft())->loadOneWhere( 'authorPHID = %s AND draftKey = %s', $user->getPHID(), diff --git a/webroot/rsrc/js/application/differential/behavior-keyboard-nav.js b/webroot/rsrc/js/application/differential/behavior-keyboard-nav.js index 8d46a31b50..2944095d47 100644 --- a/webroot/rsrc/js/application/differential/behavior-keyboard-nav.js +++ b/webroot/rsrc/js/application/differential/behavior-keyboard-nav.js @@ -220,10 +220,11 @@ JX.behavior('differential-keyboard-navigation', function(config) { }) .register(); - - new JX.KeyboardShortcut('z', 'Haunt / unhaunt comment panel.') - .setHandler(haunt) - .register(); + if (config.haunt) { + new JX.KeyboardShortcut('z', 'Haunt / unhaunt comment panel.') + .setHandler(haunt) + .register(); + } });