1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Seperate repository home and browse view in tab menu

Summary:
The tab menu in a repository can be a bit confusing. The first tab will be rendered active for two distinctive states:

- the home view in the currently selected branch
- the browse view in the currently selected branch

This diff will give the home view a dedicated extra tab. When switching the branches, we won't switch between home and browse view like it is done now.

And I have changed the crumb text for the browse view to "Code" to match it up with the tab name.

Additionally the readme is now the first content on the home view.

Fixes T15728

Test Plan: Browse in your favorite repos and feel an UX elevation.

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

Reviewed By: O1 Blessed Committers, avivey, valerio.bozzolan

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15728

Differential Revision: https://we.phorge.it/D25538
This commit is contained in:
Benjamin Kausch 2024-04-02 11:55:29 +02:00
parent 713188bf17
commit ba835fe0ec
2 changed files with 19 additions and 7 deletions

View file

@ -211,7 +211,7 @@ abstract class DiffusionController extends PhabricatorController {
$view_name = pht('History'); $view_name = pht('History');
break; break;
case 'browse': case 'browse':
$view_name = pht('Browse'); $view_name = pht('Code');
break; break;
case 'lint': case 'lint':
$view_name = pht('Lint'); $view_name = pht('Lint');
@ -502,6 +502,18 @@ abstract class DiffusionController extends PhabricatorController {
$view = new PHUIListView(); $view = new PHUIListView();
$view->addMenuItem(
id(new PHUIListItemView())
->setKey('home')
->setName(pht('Home'))
->setIcon('fa-home')
->setHref($drequest->generateURI(
array(
'action' => 'branch',
'path' => '',
)))
->setSelected($key == 'home'));
$view->addMenuItem( $view->addMenuItem(
id(new PHUIListItemView()) id(new PHUIListItemView())
->setKey('code') ->setKey('code')

View file

@ -109,7 +109,7 @@ final class DiffusionRepositoryController extends DiffusionController {
->setErrors(array($empty_message)); ->setErrors(array($empty_message));
} }
$tabs = $this->buildTabsView('code'); $tabs = $this->buildTabsView('home');
$clone_uri = $drequest->generateURI( $clone_uri = $drequest->generateURI(
array( array(
@ -243,16 +243,16 @@ final class DiffusionRepositoryController extends DiffusionController {
$readme = null; $readme = null;
} }
if ($readme) {
$content[] = $readme;
}
$content[] = $this->buildBrowseTable( $content[] = $this->buildBrowseTable(
$browse_results, $browse_results,
$browse_paths, $browse_paths,
$browse_exception, $browse_exception,
$browse_pager); $browse_pager);
if ($readme) {
$content[] = $readme;
}
try { try {
$branch_button = $this->buildBranchList($drequest); $branch_button = $this->buildBranchList($drequest);
$this->branchButton = $branch_button; $this->branchButton = $branch_button;
@ -396,7 +396,7 @@ final class DiffusionRepositoryController extends DiffusionController {
foreach ($branches as $branch) { foreach ($branches as $branch) {
$branch_uri = $drequest->generateURI( $branch_uri = $drequest->generateURI(
array( array(
'action' => 'browse', 'action' => 'branch',
'branch' => $branch->getShortname(), 'branch' => $branch->getShortname(),
)); ));
$actions->addAction( $actions->addAction(