From aa98d9e5f8ce0ce91fccf4996d8f3e2a7d99dc43 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 5 Mar 2015 14:03:15 -0800 Subject: [PATCH] Merge behavior-show-more into behavior-populate Summary: Ref T2009. It doesn't make sense to have these as separate behaviors. We require a ChangesetViewManager to track view parameter state. Test Plan: Interacted with changesets in Phriction, Differential and Diffusion. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T2009 Differential Revision: https://secure.phabricator.com/D11979 --- resources/celerity/map.php | 31 ++++++------------- resources/celerity/packages.php | 1 - .../DifferentialChangesetViewController.php | 1 - .../view/DifferentialChangesetListView.php | 1 - .../controller/PhrictionDiffController.php | 1 - .../differential/behavior-populate.js | 14 +++++++++ .../differential/behavior-show-more.js | 27 ---------------- 7 files changed, 24 insertions(+), 52 deletions(-) delete mode 100644 webroot/rsrc/js/application/differential/behavior-show-more.js diff --git a/resources/celerity/map.php b/resources/celerity/map.php index eef8a2b476..da15078aec 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -11,7 +11,7 @@ return array( 'core.pkg.js' => 'a77025a1', 'darkconsole.pkg.js' => '8ab24e01', 'differential.pkg.css' => 'd8866ed8', - 'differential.pkg.js' => '9e55f9f5', + 'differential.pkg.js' => '4db30ad2', 'diffusion.pkg.css' => '591664fa', 'diffusion.pkg.js' => 'bfc0737b', 'maniphest.pkg.css' => '68d4dd3d', @@ -369,9 +369,8 @@ return array( 'rsrc/js/application/differential/behavior-dropdown-menus.js' => '2035b9cb', 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '65936067', 'rsrc/js/application/differential/behavior-keyboard-nav.js' => '2c426492', - 'rsrc/js/application/differential/behavior-populate.js' => 'bdb3e4d0', + 'rsrc/js/application/differential/behavior-populate.js' => '8694b1df', 'rsrc/js/application/differential/behavior-show-field-details.js' => 'bba9eedf', - 'rsrc/js/application/differential/behavior-show-more.js' => 'c662904a', 'rsrc/js/application/differential/behavior-toggle-files.js' => 'ca3f91eb', 'rsrc/js/application/differential/behavior-user-select.js' => 'a8d8459d', 'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => 'b42eddc7', @@ -573,9 +572,8 @@ return array( 'javelin-behavior-differential-edit-inline-comments' => '65936067', 'javelin-behavior-differential-feedback-preview' => '6932def3', 'javelin-behavior-differential-keyboard-navigation' => '2c426492', - 'javelin-behavior-differential-populate' => 'bdb3e4d0', + 'javelin-behavior-differential-populate' => '8694b1df', 'javelin-behavior-differential-show-field-details' => 'bba9eedf', - 'javelin-behavior-differential-show-more' => 'c662904a', 'javelin-behavior-differential-toggle-files' => 'ca3f91eb', 'javelin-behavior-differential-user-select' => 'a8d8459d', 'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04', @@ -1448,6 +1446,13 @@ return array( '85ea0626' => array( 'javelin-install', ), + '8694b1df' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-stratcom', + 'phabricator-tooltip', + 'changeset-view-manager', + ), '869e3445' => array( 'javelin-behavior', 'javelin-dom', @@ -1704,13 +1709,6 @@ return array( 'javelin-util', 'javelin-request', ), - 'bdb3e4d0' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-stratcom', - 'phabricator-tooltip', - 'changeset-view-manager', - ), 'be807912' => array( 'javelin-behavior', 'javelin-dom', @@ -1731,14 +1729,6 @@ return array( 'javelin-stratcom', 'javelin-vector', ), - 'c662904a' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-workflow', - 'javelin-util', - 'javelin-stratcom', - 'changeset-view-manager', - ), 'c90a04fc' => array( 'javelin-dom', 'javelin-dynval', @@ -2160,7 +2150,6 @@ return array( 'javelin-behavior-differential-feedback-preview', 'javelin-behavior-differential-edit-inline-comments', 'javelin-behavior-differential-populate', - 'javelin-behavior-differential-show-more', 'javelin-behavior-differential-diff-radios', 'javelin-behavior-differential-comment-jump', 'javelin-behavior-differential-add-reviewers-and-ccs', diff --git a/resources/celerity/packages.php b/resources/celerity/packages.php index cc9768196e..8110025896 100644 --- a/resources/celerity/packages.php +++ b/resources/celerity/packages.php @@ -156,7 +156,6 @@ return array( 'javelin-behavior-differential-feedback-preview', 'javelin-behavior-differential-edit-inline-comments', 'javelin-behavior-differential-populate', - 'javelin-behavior-differential-show-more', 'javelin-behavior-differential-diff-radios', 'javelin-behavior-differential-comment-jump', 'javelin-behavior-differential-add-reviewers-and-ccs', diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index 59691aa408..060892436e 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -240,7 +240,6 @@ final class DifferentialChangesetViewController extends DifferentialController { 'changesetViewIDs' => array($detail->getID()), )); - Javelin::initBehavior('differential-show-more'); Javelin::initBehavior('differential-comment-jump', array()); $panel = new DifferentialPrimaryPaneView(); diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php index e63c3d613f..077cf688ca 100644 --- a/src/applications/differential/view/DifferentialChangesetListView.php +++ b/src/applications/differential/view/DifferentialChangesetListView.php @@ -209,7 +209,6 @@ final class DifferentialChangesetListView extends AphrontView { 'changesetViewIDs' => $ids, )); - $this->initBehavior('differential-show-more'); $this->initBehavior('differential-comment-jump', array()); if ($this->inlineURI) { diff --git a/src/applications/phriction/controller/PhrictionDiffController.php b/src/applications/phriction/controller/PhrictionDiffController.php index 7c4dbc0bc8..36c7d75941 100644 --- a/src/applications/phriction/controller/PhrictionDiffController.php +++ b/src/applications/phriction/controller/PhrictionDiffController.php @@ -108,7 +108,6 @@ final class PhrictionDiffController extends PhrictionController { Javelin::initBehavior('differential-populate', array( 'changesetViewIDs' => array($output->getID()), )); - Javelin::initBehavior('differential-show-more'); $slug = $document->getSlug(); diff --git a/webroot/rsrc/js/application/differential/behavior-populate.js b/webroot/rsrc/js/application/differential/behavior-populate.js index e89cb34ada..6d0aabb213 100644 --- a/webroot/rsrc/js/application/differential/behavior-populate.js +++ b/webroot/rsrc/js/application/differential/behavior-populate.js @@ -36,6 +36,20 @@ JX.behavior('differential-populate', function(config) { } }); + JX.Stratcom.listen( + 'click', + 'show-more', + function(e) { + e.kill(); + + var changeset = e.getNode('differential-changeset'); + var view = JX.ChangesetViewManager.getForNode(changeset); + var data = e.getNodeData('show-more'); + var target = e.getNode('context-target'); + + view.loadContext(data.range, target); + }); + var highlighted = null; var highlight_class = null; diff --git a/webroot/rsrc/js/application/differential/behavior-show-more.js b/webroot/rsrc/js/application/differential/behavior-show-more.js deleted file mode 100644 index 4ef4964f7c..0000000000 --- a/webroot/rsrc/js/application/differential/behavior-show-more.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @provides javelin-behavior-differential-show-more - * @requires javelin-behavior - * javelin-dom - * javelin-workflow - * javelin-util - * javelin-stratcom - * changeset-view-manager - */ - -JX.behavior('differential-show-more', function() { - - JX.Stratcom.listen( - 'click', - 'show-more', - function(e) { - e.kill(); - - var changeset = e.getNode('differential-changeset'); - var view = JX.ChangesetViewManager.getForNode(changeset); - var data = e.getNodeData('show-more'); - var target = e.getNode('context-target'); - - view.loadContext(data.range, target); - }); - -});