@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Move Diffusion Browse to a single column layout

Summary: The main change here is moving (compare, search, history) into buttons in the header bar on all browse views. This allows Directory Browsing to be full width, since there is no other curtain information. File, Image, LFS, Binary all stay in TwoColumn layouts with the same buttons in the header.

Test Plan: Test viewing a directory, file, image, binary file, readme, and fake a gitlfs.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17766

+123 -97
+2
resources/celerity/map.php
··· 74 74 'rsrc/css/application/diffusion/diffusion-history.css' => '4540f568', 75 75 'rsrc/css/application/diffusion/diffusion-icons.css' => 'a6a1e2ba', 76 76 'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6', 77 + 'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec', 77 78 'rsrc/css/application/diffusion/diffusion-source.css' => '750add59', 78 79 'rsrc/css/application/feed/feed.css' => 'ecd4ec57', 79 80 'rsrc/css/application/files/global-drag-and-drop.css' => '5c1b47c2', ··· 572 573 'diffusion-history-css' => '4540f568', 573 574 'diffusion-icons-css' => 'a6a1e2ba', 574 575 'diffusion-readme-css' => '419dd5b6', 576 + 'diffusion-repository-css' => 'ee6f20ec', 575 577 'diffusion-source-css' => '750add59', 576 578 'diviner-shared-css' => '896f1d43', 577 579 'font-fontawesome' => 'e838e088',
+97 -96
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 106 106 $path = $drequest->getPath(); 107 107 108 108 $blame_key = PhabricatorDiffusionBlameSetting::SETTINGKEY; 109 - 110 109 $show_blame = $request->getBool( 111 110 'blame', 112 111 $viewer->getUserSetting($blame_key)); ··· 160 159 $hit_time_limit = $response['tooSlow']; 161 160 162 161 $file_phid = $response['filePHID']; 162 + $show_editor = false; 163 163 if ($hit_byte_limit) { 164 164 $corpus = $this->buildErrorCorpus( 165 165 pht( ··· 215 215 } else { 216 216 $this->loadLintMessages(); 217 217 $this->coverage = $drequest->loadCoverage(); 218 + $show_editor = true; 218 219 219 220 // Build the content of the file. 220 221 $corpus = $this->buildCorpus( ··· 234 235 require_celerity_resource('diffusion-source-css'); 235 236 236 237 // Render the page. 237 - $view = $this->buildCurtain($drequest); 238 - $curtain = $this->enrichCurtain( 239 - $view, 240 - $drequest, 241 - $show_blame); 242 - 238 + $curtain = $this->buildCurtain($drequest, $show_blame, $show_editor); 243 239 $properties = $this->buildPropertyView($drequest); 244 240 $header = $this->buildHeaderView($drequest); 245 241 $header->setHeaderIcon('fa-file-code-o'); ··· 327 323 328 324 $reason = $results->getReasonForEmptyResultSet(); 329 325 330 - $curtain = $this->buildCurtain($drequest); 326 + $actions = $this->getActions($drequest); 331 327 $details = $this->buildPropertyView($drequest); 332 328 333 329 $header = $this->buildHeaderView($drequest); ··· 363 359 ->setPaths($results->getPaths()) 364 360 ->setUser($request->getUser()); 365 361 366 - $browse_header = id(new PHUIHeaderView()) 367 - ->setHeader(nonempty(basename($drequest->getPath()), '/')) 368 - ->setHeaderIcon('fa-folder-open'); 362 + $title = nonempty(basename($drequest->getPath()), '/'); 363 + $icon = 'fa-folder-open'; 364 + $browse_header = $this->buildPanelHeaderView($title, $icon, $actions); 369 365 370 366 $browse_panel = id(new PHUIObjectBoxView()) 371 367 ->setHeader($browse_header) ··· 400 396 401 397 $view = id(new PHUITwoColumnView()) 402 398 ->setHeader($header) 403 - ->setCurtain($curtain) 404 - ->setMainColumn( 399 + ->setFooter( 405 400 array( 406 401 $branch_panel, 407 402 $empty_result, 408 403 $browse_panel, 409 - )) 410 - ->setFooter( 411 - array( 412 404 $open_revisions, 413 405 $readme, 414 406 )); ··· 745 737 746 738 Javelin::initBehavior('load-blame', array('id' => $id)); 747 739 740 + $file = $this->renderFileButton(); 741 + $title = basename($this->getDiffusionRequest()->getPath()); 742 + $icon = 'fa-file-code-o'; 743 + $drequest = $this->getDiffusionRequest(); 744 + $actions = $this->getActions($drequest); 748 745 749 - $edit = $this->renderEditButton(); 750 - $file = $this->renderFileButton(); 751 - $header = id(new PHUIHeaderView()) 752 - ->setHeader(basename($this->getDiffusionRequest()->getPath())) 753 - ->setHeaderIcon('fa-file-code-o') 754 - ->addActionLink($edit) 755 - ->addActionLink($file); 746 + $header = $this->buildPanelHeaderView($title, $icon, $actions); 747 + $header->addActionLink($file); 756 748 757 749 $corpus = id(new PHUIObjectBoxView()) 758 750 ->setHeader($header) ··· 791 783 return $corpus; 792 784 } 793 785 794 - private function enrichCurtain( 795 - PHUICurtainView $curtain, 786 + private function buildCurtain( 796 787 DiffusionRequest $drequest, 797 - $show_blame) { 788 + $show_blame, 789 + $show_editor) { 798 790 791 + $curtain = $this->newCurtainView($drequest); 799 792 $viewer = $this->getViewer(); 800 793 $base_uri = $this->getRequest()->getRequestURI(); 801 794 795 + $user = $this->getRequest()->getUser(); 796 + $repository = $drequest->getRepository(); 797 + $path = $drequest->getPath(); 798 + $line = nonempty((int)$drequest->getLine(), 1); 799 + 800 + $editor_link = $user->loadEditorLink($path, $line, $repository); 801 + $template = $user->loadEditorLink($path, '%l', $repository); 802 + 802 803 $curtain->addAction( 803 804 id(new PhabricatorActionView()) 804 805 ->setName(pht('Show Last Change')) ··· 826 827 ->setIcon($blame_icon) 827 828 ->setUser($viewer) 828 829 ->setRenderAsForm($viewer->isLoggedIn())); 830 + 831 + $curtain->addAction( 832 + id(new PhabricatorActionView()) 833 + ->setName(pht('Open in Editor')) 834 + ->setHref($editor_link) 835 + ->setIcon('fa-pencil') 836 + ->setID('editor_link') 837 + ->setMetadata(array('link_template' => $template)) 838 + ->setDisabled(!$editor_link)); 829 839 830 840 $href = null; 831 841 if ($this->getRequest()->getStr('lint') !== null) { ··· 897 907 return $curtain; 898 908 } 899 909 900 - private function renderEditButton() { 901 - $request = $this->getRequest(); 902 - $user = $request->getUser(); 903 - 904 - $drequest = $this->getDiffusionRequest(); 905 - 906 - $repository = $drequest->getRepository(); 907 - $path = $drequest->getPath(); 908 - $line = nonempty((int)$drequest->getLine(), 1); 909 - 910 - $editor_link = $user->loadEditorLink($path, $line, $repository); 911 - $template = $user->loadEditorLink($path, '%l', $repository); 912 - 913 - $button = id(new PHUIButtonView()) 914 - ->setTag('a') 915 - ->setText(pht('Open in Editor')) 916 - ->setHref($editor_link) 917 - ->setIcon('fa-pencil') 918 - ->setID('editor_link') 919 - ->setMetadata(array('link_template' => $template)) 920 - ->setDisabled(!$editor_link); 921 - 922 - return $button; 923 - } 924 - 925 910 private function renderFileButton($file_uri = null, $label = null) { 926 911 927 912 $base_uri = $this->getRequest()->getRequestURI(); 928 913 929 914 if ($file_uri) { 930 - $text = pht('Download Raw File'); 915 + $text = pht('Download Raw'); 931 916 $href = $file_uri; 932 917 $icon = 'fa-download'; 933 918 } else { 934 - $text = pht('View Raw File'); 919 + $text = pht('View Raw'); 935 920 $href = $base_uri->alter('view', 'raw'); 936 921 $icon = 'fa-file-text'; 937 922 } ··· 1374 1359 ))); 1375 1360 1376 1361 $file = $this->renderFileButton($file_uri); 1377 - $header = id(new PHUIHeaderView()) 1378 - ->setHeader(basename($this->getDiffusionRequest()->getPath())) 1379 - ->addActionLink($file) 1380 - ->setHeaderIcon('fa-file-image-o'); 1362 + $title = basename($this->getDiffusionRequest()->getPath()); 1363 + $icon = 'fa-file-image-o'; 1364 + $drequest = $this->getDiffusionRequest(); 1365 + $actions = $this->getActions($drequest); 1366 + $header = $this->buildPanelHeaderView($title, $icon, $actions); 1367 + $header->addActionLink($file); 1381 1368 1382 1369 return id(new PHUIObjectBoxView()) 1383 1370 ->setHeader($header) ··· 1393 1380 ->appendChild($text); 1394 1381 1395 1382 $file = $this->renderFileButton($file_uri); 1396 - $header = id(new PHUIHeaderView()) 1397 - ->setHeader(pht('Details')) 1398 - ->addActionLink($file); 1383 + $title = basename($this->getDiffusionRequest()->getPath()); 1384 + $icon = 'fa-file'; 1385 + $drequest = $this->getDiffusionRequest(); 1386 + $actions = $this->getActions($drequest); 1387 + $header = $this->buildPanelHeaderView($title, $icon, $actions); 1388 + $header->addActionLink($file); 1399 1389 1400 1390 $box = id(new PHUIObjectBoxView()) 1401 1391 ->setHeader($header) ··· 1656 1646 return $header; 1657 1647 } 1658 1648 1659 - protected function buildCurtain(DiffusionRequest $drequest) { 1660 - $viewer = $this->getViewer(); 1661 - $repository = $drequest->getRepository(); 1649 + protected function buildPanelHeaderView($title, $icon, array $actions) { 1662 1650 1663 - $curtain = $this->newCurtainView($drequest); 1651 + $header = id(new PHUIHeaderView()) 1652 + ->setHeader($title) 1653 + ->setHeaderIcon($icon) 1654 + ->addClass('diffusion-panel-header-view'); 1664 1655 1665 - $history_uri = $drequest->generateURI( 1666 - array( 1667 - 'action' => 'history', 1668 - )); 1656 + foreach ($actions as $action_link) { 1657 + if ($action_link) { 1658 + $header->addActionLink($action_link); 1659 + } 1660 + } 1661 + return $header; 1669 1662 1670 - $curtain->addAction( 1671 - id(new PhabricatorActionView()) 1672 - ->setName(pht('View History')) 1673 - ->setHref($history_uri) 1674 - ->setIcon('fa-list')); 1663 + } 1675 1664 1665 + protected function getActions(DiffusionRequest $drequest) { 1666 + $viewer = $this->getViewer(); 1667 + $repository = $drequest->getRepository(); 1668 + $history_uri = $drequest->generateURI(array('action' => 'history')); 1676 1669 $behind_head = $drequest->getSymbolicCommit(); 1677 - 1678 - if ($repository->supportsBranchComparison()) { 1679 - $compare_uri = $drequest->generateURI( 1680 - array( 1681 - 'action' => 'compare', 1682 - )); 1683 - 1684 - $curtain->addAction( 1685 - id(new PhabricatorActionView()) 1686 - ->setName(pht('Compare Against...')) 1687 - ->setIcon('fa-code-fork') 1688 - ->setWorkflow(true) 1689 - ->setHref($compare_uri)); 1690 - } 1691 - 1692 1670 $head_uri = $drequest->generateURI( 1693 1671 array( 1694 1672 'commit' => '', 1695 1673 'action' => 'browse', 1696 1674 )); 1697 - $curtain->addAction( 1698 - id(new PhabricatorActionView()) 1699 - ->setName(pht('Jump to HEAD')) 1675 + 1676 + if ($repository->supportsBranchComparison()) { 1677 + $compare_uri = $drequest->generateURI(array('action' => 'compare')); 1678 + $compare = id(new PHUIButtonView()) 1679 + ->setText(pht('Compare')) 1680 + ->setIcon('fa-code-fork') 1681 + ->setWorkflow(true) 1682 + ->setTag('a') 1683 + ->setHref($compare_uri) 1684 + ->setColor(PHUIButtonView::GREY); 1685 + } 1686 + 1687 + $head = null; 1688 + if ($behind_head) { 1689 + $head = id(new PHUIButtonView()) 1690 + ->setText(pht('Back to HEAD')) 1700 1691 ->setHref($head_uri) 1701 1692 ->setIcon('fa-home') 1702 - ->setDisabled(!$behind_head)); 1693 + ->setColor(PHUIButtonView::GREY); 1694 + } 1703 1695 1704 - return $curtain; 1696 + $history = id(new PHUIButtonView()) 1697 + ->setText(pht('History')) 1698 + ->setHref($history_uri) 1699 + ->setTag('a') 1700 + ->setIcon('fa-history') 1701 + ->setColor(PHUIButtonView::GREY); 1702 + 1703 + return array($history, $compare, $head); 1705 1704 } 1706 1705 1707 1706 protected function buildPropertyView( ··· 1902 1901 // show the user an error if we can't, rather than making them click 1903 1902 // through to hit an error. 1904 1903 1905 - $header = id(new PHUIHeaderView()) 1906 - ->setHeader(basename($this->getDiffusionRequest()->getPath())) 1907 - ->setHeaderIcon('fa-archive'); 1904 + $title = basename($this->getDiffusionRequest()->getPath()); 1905 + $icon = 'fa-archive'; 1906 + $drequest = $this->getDiffusionRequest(); 1907 + $actions = $this->getActions($drequest); 1908 + $header = $this->buildPanelHeaderView($title, $icon, $actions); 1908 1909 1909 1910 $severity = PHUIInfoView::SEVERITY_NOTICE; 1910 1911
+1
src/applications/diffusion/controller/DiffusionController.php
··· 44 44 private function loadContext(array $options) { 45 45 $request = $this->getRequest(); 46 46 $viewer = $this->getViewer(); 47 + require_celerity_resource('diffusion-repository-css'); 47 48 48 49 $identifier = $this->getRepositoryIdentifierFromRequest($request); 49 50
+5 -1
src/applications/diffusion/view/DiffusionReadmeView.php
··· 98 98 ->setFluid(true) 99 99 ->appendChild($readme_content); 100 100 101 + $header = id(new PHUIHeaderView()) 102 + ->setHeader($readme_name) 103 + ->addClass('diffusion-panel-header-view'); 104 + 101 105 return id(new PHUIObjectBoxView()) 102 - ->setHeaderText($readme_name) 106 + ->setHeader($header) 103 107 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 104 108 ->appendChild($document) 105 109 ->addClass('diffusion-readme-view');
+5
src/view/layout/PhabricatorActionView.php
··· 119 119 return $this->openInNewWindow; 120 120 } 121 121 122 + public function setID($id) { 123 + $this->id = $id; 124 + return $this; 125 + } 126 + 122 127 public function getID() { 123 128 if (!$this->id) { 124 129 $this->id = celerity_generate_unique_node_id();
+13
webroot/rsrc/css/application/diffusion/diffusion-repository.css
··· 1 + /** 2 + * @provides diffusion-repository-css 3 + */ 4 + 5 + .diffusion-page-header-view a.phui-header-action-link { 6 + display: block; 7 + float: none; 8 + } 9 + 10 + .phui-box.phui-object-box.phui-box-blue-property 11 + .diffusion-panel-header-view.phui-header-shell { 12 + padding: 8px 4px 8px 16px; 13 + }