@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.

Add branch, tag info to Diffusion Headers

Summary: Improves overall UX of browsing Diffusion. Clarifies branch and tag when possible, changes 'home' to 'code', uses tabs in more locations. Fixes T12837

Test Plan: Review branchs, tags, git, hg, search, browse, history.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12837

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

+100 -9
+2 -2
resources/celerity/map.php
··· 75 75 'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6', 76 76 'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec', 77 77 'rsrc/css/application/diffusion/diffusion-source.css' => '750add59', 78 - 'rsrc/css/application/diffusion/diffusion.css' => '34d507b9', 78 + 'rsrc/css/application/diffusion/diffusion.css' => '58e0704b', 79 79 'rsrc/css/application/feed/feed.css' => 'ecd4ec57', 80 80 'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948', 81 81 'rsrc/css/application/flag/flag.css' => 'bba8f811', ··· 570 570 'differential-revision-history-css' => '0e8eb855', 571 571 'differential-revision-list-css' => 'f3c47d33', 572 572 'differential-table-of-contents-css' => 'ae4b7a55', 573 - 'diffusion-css' => '34d507b9', 573 + 'diffusion-css' => '58e0704b', 574 574 'diffusion-icons-css' => '0c15255e', 575 575 'diffusion-readme-css' => '419dd5b6', 576 576 'diffusion-repository-css' => 'ee6f20ec',
+5
src/applications/diffusion/controller/DiffusionBranchTableController.php
··· 71 71 ->setHeader(pht('Branches')) 72 72 ->setHeaderIcon('fa-code-fork'); 73 73 74 + if (!$repository->isSVN()) { 75 + $branch_tag = $this->renderBranchTag($drequest); 76 + $header->addTag($branch_tag); 77 + } 78 + 74 79 $tabs = $this->buildTabsView('branch'); 75 80 76 81 $view = id(new PHUITwoColumnView())
+16 -2
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 76 76 )); 77 77 $crumbs->setBorder(true); 78 78 79 + $tabs = $this->buildTabsView('code'); 80 + 79 81 $view = id(new PHUITwoColumnView()) 80 82 ->setHeader($header) 83 + ->setTabs($tabs) 81 84 ->setFooter( 82 85 array( 83 86 $search_form, ··· 291 294 $crumbs->setBorder(true); 292 295 293 296 $basename = basename($this->getDiffusionRequest()->getPath()); 297 + $tabs = $this->buildTabsView('code'); 294 298 295 299 $view = id(new PHUITwoColumnView()) 296 300 ->setHeader($header) 301 + ->setTabs($tabs) 297 302 ->setCurtain($curtain) 298 303 ->setMainColumn(array( 299 304 $content, ··· 387 392 )); 388 393 389 394 $crumbs->setBorder(true); 395 + $tabs = $this->buildTabsView('code'); 390 396 391 397 $view = id(new PHUITwoColumnView()) 392 398 ->setHeader($header) 399 + ->setTabs($tabs) 393 400 ->setFooter( 394 401 array( 395 402 $branch_panel, ··· 1491 1498 1492 1499 protected function buildHeaderView(DiffusionRequest $drequest) { 1493 1500 $viewer = $this->getViewer(); 1501 + $repository = $drequest->getRepository(); 1494 1502 1495 - $tag = $this->renderCommitHashTag($drequest); 1503 + $commit_tag = $this->renderCommitHashTag($drequest); 1504 + 1496 1505 $path = nonempty(basename($drequest->getPath()), '/'); 1497 1506 $search = $this->renderSearchForm($path); 1498 1507 ··· 1500 1509 ->setUser($viewer) 1501 1510 ->setHeader($this->renderPathLinks($drequest, $mode = 'browse')) 1502 1511 ->addActionItem($search) 1503 - ->addTag($tag) 1512 + ->addTag($commit_tag) 1504 1513 ->addClass('diffusion-browse-header'); 1514 + 1515 + if (!$repository->isSVN()) { 1516 + $branch_tag = $this->renderBranchTag($drequest); 1517 + $header->addTag($branch_tag); 1518 + } 1505 1519 1506 1520 return $header; 1507 1521 }
+36 -4
src/applications/diffusion/controller/DiffusionController.php
··· 343 343 return $tag; 344 344 } 345 345 346 + protected function renderBranchTag(DiffusionRequest $drequest) { 347 + $branch = $drequest->getBranch(); 348 + $branch = id(new PhutilUTF8StringTruncator()) 349 + ->setMaximumGlyphs(24) 350 + ->truncateString($branch); 351 + 352 + $tag = id(new PHUITagView()) 353 + ->setName($branch) 354 + ->setColor(PHUITagView::COLOR_INDIGO) 355 + ->setBorder(PHUITagView::BORDER_NONE) 356 + ->setType(PHUITagView::TYPE_OUTLINE) 357 + ->addClass('diffusion-header-branch-tag'); 358 + 359 + return $tag; 360 + } 361 + 362 + protected function renderSymbolicCommit(DiffusionRequest $drequest) { 363 + $symbolic_tag = $drequest->getSymbolicCommit(); 364 + $symbolic_tag = id(new PhutilUTF8StringTruncator()) 365 + ->setMaximumGlyphs(24) 366 + ->truncateString($symbolic_tag); 367 + 368 + $tag = id(new PHUITagView()) 369 + ->setName($symbolic_tag) 370 + ->setIcon('fa-tag') 371 + ->setColor(PHUITagView::COLOR_INDIGO) 372 + ->setBorder(PHUITagView::BORDER_NONE) 373 + ->setType(PHUITagView::TYPE_SHADE); 374 + 375 + return $tag; 376 + } 377 + 346 378 protected function renderDirectoryReadme(DiffusionBrowseResultSet $browse) { 347 379 $readme_path = $browse->getReadmePath(); 348 380 if ($readme_path === null) { ··· 470 502 471 503 $view->addMenuItem( 472 504 id(new PHUIListItemView()) 473 - ->setKey('home') 474 - ->setName(pht('Home')) 475 - ->setIcon('fa-home') 505 + ->setKey('code') 506 + ->setName(pht('Code')) 507 + ->setIcon('fa-code') 476 508 ->setHref($drequest->generateURI( 477 509 array( 478 510 'action' => 'branch', 479 511 'path' => '/', 480 512 ))) 481 - ->setSelected($key == 'home')); 513 + ->setSelected($key == 'code')); 482 514 483 515 if (!$repository->isSVN()) { 484 516 $view->addMenuItem(
+7
src/applications/diffusion/controller/DiffusionGraphController.php
··· 11 11 if ($response) { 12 12 return $response; 13 13 } 14 + require_celerity_resource('diffusion-css'); 14 15 15 16 $viewer = $this->getViewer(); 16 17 $drequest = $this->getDiffusionRequest(); ··· 83 84 84 85 private function buildHeader(DiffusionRequest $drequest) { 85 86 $viewer = $this->getViewer(); 87 + $repository = $drequest->getRepository(); 86 88 87 89 $no_path = !strlen($drequest->getPath()); 88 90 if ($no_path) { ··· 95 97 ->setUser($viewer) 96 98 ->setHeader($header_text) 97 99 ->setHeaderIcon('fa-code-fork'); 100 + 101 + if (!$repository->isSVN()) { 102 + $branch_tag = $this->renderBranchTag($drequest); 103 + $header->addTag($branch_tag); 104 + } 98 105 99 106 return $header; 100 107
+12
src/applications/diffusion/controller/DiffusionHistoryController.php
··· 11 11 if ($response) { 12 12 return $response; 13 13 } 14 + require_celerity_resource('diffusion-css'); 14 15 15 16 $viewer = $this->getViewer(); 16 17 $drequest = $this->getDiffusionRequest(); ··· 78 79 79 80 private function buildHeader(DiffusionRequest $drequest) { 80 81 $viewer = $this->getViewer(); 82 + $repository = $drequest->getRepository(); 81 83 82 84 $no_path = !strlen($drequest->getPath()); 83 85 if ($no_path) { ··· 90 92 ->setUser($viewer) 91 93 ->setHeader($header_text) 92 94 ->setHeaderIcon('fa-clock-o'); 95 + 96 + if (!$repository->isSVN()) { 97 + $branch_tag = $this->renderBranchTag($drequest); 98 + $header->addTag($branch_tag); 99 + } 100 + 101 + if ($drequest->getSymbolicCommit()) { 102 + $symbolic_tag = $this->renderSymbolicCommit($drequest); 103 + $header->addTag($symbolic_tag); 104 + } 93 105 94 106 return $header; 95 107
+10 -1
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 98 98 ->setErrors(array($empty_message)); 99 99 } 100 100 101 - $tabs = $this->buildTabsView('home'); 101 + $tabs = $this->buildTabsView('code'); 102 102 103 103 $clone_uri = $drequest->generateURI( 104 104 array( ··· 300 300 301 301 private function buildHeaderView(PhabricatorRepository $repository) { 302 302 $viewer = $this->getViewer(); 303 + $drequest = $this->getDiffusionRequest(); 303 304 $search = $this->renderSearchForm(); 304 305 305 306 $header = id(new PHUIHeaderView()) ··· 323 324 pht('Importing (%s)...', $percentage)); 324 325 } else { 325 326 $header->setStatus('fa-check', 'bluegrey', pht('Active')); 327 + } 328 + 329 + if (!$repository->isSVN()) { 330 + $default = $repository->getDefaultBranch(); 331 + if ($default != $drequest->getBranch()) { 332 + $branch_tag = $this->renderBranchTag($drequest); 333 + $header->addTag($branch_tag); 334 + } 326 335 } 327 336 328 337 return $header;
+6
src/applications/diffusion/controller/DiffusionTagListController.php
··· 11 11 if ($response) { 12 12 return $response; 13 13 } 14 + require_celerity_resource('diffusion-css'); 14 15 15 16 $viewer = $this->getViewer(); 16 17 $drequest = $this->getDiffusionRequest(); ··· 49 50 $header = id(new PHUIHeaderView()) 50 51 ->setHeader(pht('Tags')) 51 52 ->setHeaderIcon('fa-tags'); 53 + 54 + if (!$repository->isSVN()) { 55 + $branch_tag = $this->renderBranchTag($drequest); 56 + $header->addTag($branch_tag); 57 + } 52 58 53 59 if (!$tags) { 54 60 $content = $this->renderStatusMessage(
+6
webroot/rsrc/css/application/diffusion/diffusion.css
··· 122 122 margin-right: 4px; 123 123 } 124 124 125 + .diffusion-header-branch-tag.phui-tag-view.phui-tag-type-outline 126 + .phui-tag-core { 127 + padding: 3px 12px 2px; 128 + font-size: {$normalfontsize}; 129 + } 130 + 125 131 /* - Browse Styles ----------------------------------------------------------*/ 126 132 127 133 .diffusion-browse-table .commit-detail {