diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -391,7 +391,7 @@ 'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'b7b73831', 'rsrc/js/application/diffusion/behavior-commit-branches.js' => '4b671572', 'rsrc/js/application/diffusion/behavior-commit-graph.js' => 'ac10c917', - 'rsrc/js/application/diffusion/behavior-locate-file.js' => '87428eb2', + 'rsrc/js/application/diffusion/behavior-locate-file.js' => '4c77f259', 'rsrc/js/application/diffusion/behavior-pull-lastmodified.js' => 'c715c123', 'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => '6a85bc5a', 'rsrc/js/application/drydock/drydock-live-operation-status.js' => '47a0728b', @@ -619,7 +619,7 @@ 'javelin-behavior-differential-populate' => 'b86ef6c2', 'javelin-behavior-diffusion-commit-branches' => '4b671572', 'javelin-behavior-diffusion-commit-graph' => 'ac10c917', - 'javelin-behavior-diffusion-locate-file' => '87428eb2', + 'javelin-behavior-diffusion-locate-file' => '4c77f259', 'javelin-behavior-diffusion-pull-lastmodified' => 'c715c123', 'javelin-behavior-document-engine' => '243d6c22', 'javelin-behavior-doorkeeper-tag' => '6a85bc5a', @@ -1375,6 +1375,13 @@ 'javelin-install', 'javelin-dom', ), + '4c77f259' => array( + 'javelin-behavior', + 'javelin-diffusion-locate-file-source', + 'javelin-dom', + 'javelin-typeahead', + 'javelin-uri', + ), '4dffaeb2' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1672,13 +1679,6 @@ '84f82dad' => array( 'javelin-install', ), - '87428eb2' => array( - 'javelin-behavior', - 'javelin-diffusion-locate-file-source', - 'javelin-dom', - 'javelin-typeahead', - 'javelin-uri', - ), '876506b6' => array( 'javelin-view', 'javelin-install', diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -326,9 +326,11 @@ )); $crumbs->setBorder(true); + $locate_file = $this->buildLocateFile(); $tabs = $this->buildTabsView('code'); $owners_list = $this->buildOwnersList($drequest); $bar = id(new PHUILeftRightView()) + ->setLeft($locate_file) ->setRight($this->corpusButtons) ->addClass('diffusion-action-bar'); diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -554,4 +554,47 @@ } + /** + * @return PHUIBoxView|null + */ + protected function buildLocateFile() { + $request = $this->getRequest(); + $viewer = $request->getUser(); + $drequest = $this->getDiffusionRequest(); + $repository = $drequest->getRepository(); + + $form_box = null; + if ($repository->canUsePathTree()) { + Javelin::initBehavior( + 'diffusion-locate-file', + array( + 'controlID' => 'locate-control', + 'inputID' => 'locate-input', + 'symbolicCommit' => $drequest->getSymbolicCommit(), + 'browseBaseURI' => (string)$drequest->generateURI( + array( + 'action' => 'browse', + 'commit' => '', + 'path' => '', + )), + 'uri' => (string)$drequest->generateURI( + array( + 'action' => 'pathtree', + )), + )); + + $form = id(new AphrontFormView()) + ->setUser($viewer) + ->appendChild( + id(new AphrontFormTypeaheadControl()) + ->setHardpointID('locate-control') + ->setID('locate-input') + ->setPlaceholder(pht('Locate File'))); + $form_box = id(new PHUIBoxView()) + ->appendChild($form->buildLayoutView()) + ->addClass('diffusion-profile-locate'); + } + return $form_box; + } + } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -433,43 +433,6 @@ return $button; } - private function buildLocateFile() { - $request = $this->getRequest(); - $viewer = $request->getUser(); - $drequest = $this->getDiffusionRequest(); - $repository = $drequest->getRepository(); - - $form_box = null; - if ($repository->canUsePathTree()) { - Javelin::initBehavior( - 'diffusion-locate-file', - array( - 'controlID' => 'locate-control', - 'inputID' => 'locate-input', - 'browseBaseURI' => (string)$drequest->generateURI( - array( - 'action' => 'browse', - )), - 'uri' => (string)$drequest->generateURI( - array( - 'action' => 'pathtree', - )), - )); - - $form = id(new AphrontFormView()) - ->setUser($viewer) - ->appendChild( - id(new AphrontFormTypeaheadControl()) - ->setHardpointID('locate-control') - ->setID('locate-input') - ->setPlaceholder(pht('Locate File'))); - $form_box = id(new PHUIBoxView()) - ->appendChild($form->buildLayoutView()) - ->addClass('diffusion-profile-locate'); - } - return $form_box; - } - private function buildBrowseTable( $browse_results, $browse_paths, diff --git a/webroot/rsrc/js/application/diffusion/behavior-locate-file.js b/webroot/rsrc/js/application/diffusion/behavior-locate-file.js --- a/webroot/rsrc/js/application/diffusion/behavior-locate-file.js +++ b/webroot/rsrc/js/application/diffusion/behavior-locate-file.js @@ -17,7 +17,11 @@ typeahead.setDatasource(datasource); typeahead.listen('choose', function(r) { - JX.$U(config.browseBaseURI + r.ref).go(); + var browseURI = config.browseBaseURI + r.ref; + if (config.symbolicCommit) { + browseURI += ';' + config.symbolicCommit; + } + JX.$U(browseURI).go(); }); var started = false;