mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
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
This commit is contained in:
parent
7bbd26427f
commit
19dae88728
9 changed files with 100 additions and 9 deletions
|
@ -75,7 +75,7 @@ return array(
|
||||||
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
|
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
|
||||||
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
|
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
|
||||||
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
|
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
|
||||||
'rsrc/css/application/diffusion/diffusion.css' => '34d507b9',
|
'rsrc/css/application/diffusion/diffusion.css' => '58e0704b',
|
||||||
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
|
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
|
||||||
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
|
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
|
||||||
'rsrc/css/application/flag/flag.css' => 'bba8f811',
|
'rsrc/css/application/flag/flag.css' => 'bba8f811',
|
||||||
|
@ -570,7 +570,7 @@ return array(
|
||||||
'differential-revision-history-css' => '0e8eb855',
|
'differential-revision-history-css' => '0e8eb855',
|
||||||
'differential-revision-list-css' => 'f3c47d33',
|
'differential-revision-list-css' => 'f3c47d33',
|
||||||
'differential-table-of-contents-css' => 'ae4b7a55',
|
'differential-table-of-contents-css' => 'ae4b7a55',
|
||||||
'diffusion-css' => '34d507b9',
|
'diffusion-css' => '58e0704b',
|
||||||
'diffusion-icons-css' => '0c15255e',
|
'diffusion-icons-css' => '0c15255e',
|
||||||
'diffusion-readme-css' => '419dd5b6',
|
'diffusion-readme-css' => '419dd5b6',
|
||||||
'diffusion-repository-css' => 'ee6f20ec',
|
'diffusion-repository-css' => 'ee6f20ec',
|
||||||
|
|
|
@ -71,6 +71,11 @@ final class DiffusionBranchTableController extends DiffusionController {
|
||||||
->setHeader(pht('Branches'))
|
->setHeader(pht('Branches'))
|
||||||
->setHeaderIcon('fa-code-fork');
|
->setHeaderIcon('fa-code-fork');
|
||||||
|
|
||||||
|
if (!$repository->isSVN()) {
|
||||||
|
$branch_tag = $this->renderBranchTag($drequest);
|
||||||
|
$header->addTag($branch_tag);
|
||||||
|
}
|
||||||
|
|
||||||
$tabs = $this->buildTabsView('branch');
|
$tabs = $this->buildTabsView('branch');
|
||||||
|
|
||||||
$view = id(new PHUITwoColumnView())
|
$view = id(new PHUITwoColumnView())
|
||||||
|
|
|
@ -76,8 +76,11 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
));
|
));
|
||||||
$crumbs->setBorder(true);
|
$crumbs->setBorder(true);
|
||||||
|
|
||||||
|
$tabs = $this->buildTabsView('code');
|
||||||
|
|
||||||
$view = id(new PHUITwoColumnView())
|
$view = id(new PHUITwoColumnView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
|
->setTabs($tabs)
|
||||||
->setFooter(
|
->setFooter(
|
||||||
array(
|
array(
|
||||||
$search_form,
|
$search_form,
|
||||||
|
@ -291,9 +294,11 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
$crumbs->setBorder(true);
|
$crumbs->setBorder(true);
|
||||||
|
|
||||||
$basename = basename($this->getDiffusionRequest()->getPath());
|
$basename = basename($this->getDiffusionRequest()->getPath());
|
||||||
|
$tabs = $this->buildTabsView('code');
|
||||||
|
|
||||||
$view = id(new PHUITwoColumnView())
|
$view = id(new PHUITwoColumnView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
|
->setTabs($tabs)
|
||||||
->setCurtain($curtain)
|
->setCurtain($curtain)
|
||||||
->setMainColumn(array(
|
->setMainColumn(array(
|
||||||
$content,
|
$content,
|
||||||
|
@ -387,9 +392,11 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
));
|
));
|
||||||
|
|
||||||
$crumbs->setBorder(true);
|
$crumbs->setBorder(true);
|
||||||
|
$tabs = $this->buildTabsView('code');
|
||||||
|
|
||||||
$view = id(new PHUITwoColumnView())
|
$view = id(new PHUITwoColumnView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
|
->setTabs($tabs)
|
||||||
->setFooter(
|
->setFooter(
|
||||||
array(
|
array(
|
||||||
$branch_panel,
|
$branch_panel,
|
||||||
|
@ -1491,8 +1498,10 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
|
|
||||||
protected function buildHeaderView(DiffusionRequest $drequest) {
|
protected function buildHeaderView(DiffusionRequest $drequest) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
|
$commit_tag = $this->renderCommitHashTag($drequest);
|
||||||
|
|
||||||
$tag = $this->renderCommitHashTag($drequest);
|
|
||||||
$path = nonempty(basename($drequest->getPath()), '/');
|
$path = nonempty(basename($drequest->getPath()), '/');
|
||||||
$search = $this->renderSearchForm($path);
|
$search = $this->renderSearchForm($path);
|
||||||
|
|
||||||
|
@ -1500,9 +1509,14 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setHeader($this->renderPathLinks($drequest, $mode = 'browse'))
|
->setHeader($this->renderPathLinks($drequest, $mode = 'browse'))
|
||||||
->addActionItem($search)
|
->addActionItem($search)
|
||||||
->addTag($tag)
|
->addTag($commit_tag)
|
||||||
->addClass('diffusion-browse-header');
|
->addClass('diffusion-browse-header');
|
||||||
|
|
||||||
|
if (!$repository->isSVN()) {
|
||||||
|
$branch_tag = $this->renderBranchTag($drequest);
|
||||||
|
$header->addTag($branch_tag);
|
||||||
|
}
|
||||||
|
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -343,6 +343,38 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
return $tag;
|
return $tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderBranchTag(DiffusionRequest $drequest) {
|
||||||
|
$branch = $drequest->getBranch();
|
||||||
|
$branch = id(new PhutilUTF8StringTruncator())
|
||||||
|
->setMaximumGlyphs(24)
|
||||||
|
->truncateString($branch);
|
||||||
|
|
||||||
|
$tag = id(new PHUITagView())
|
||||||
|
->setName($branch)
|
||||||
|
->setColor(PHUITagView::COLOR_INDIGO)
|
||||||
|
->setBorder(PHUITagView::BORDER_NONE)
|
||||||
|
->setType(PHUITagView::TYPE_OUTLINE)
|
||||||
|
->addClass('diffusion-header-branch-tag');
|
||||||
|
|
||||||
|
return $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function renderSymbolicCommit(DiffusionRequest $drequest) {
|
||||||
|
$symbolic_tag = $drequest->getSymbolicCommit();
|
||||||
|
$symbolic_tag = id(new PhutilUTF8StringTruncator())
|
||||||
|
->setMaximumGlyphs(24)
|
||||||
|
->truncateString($symbolic_tag);
|
||||||
|
|
||||||
|
$tag = id(new PHUITagView())
|
||||||
|
->setName($symbolic_tag)
|
||||||
|
->setIcon('fa-tag')
|
||||||
|
->setColor(PHUITagView::COLOR_INDIGO)
|
||||||
|
->setBorder(PHUITagView::BORDER_NONE)
|
||||||
|
->setType(PHUITagView::TYPE_SHADE);
|
||||||
|
|
||||||
|
return $tag;
|
||||||
|
}
|
||||||
|
|
||||||
protected function renderDirectoryReadme(DiffusionBrowseResultSet $browse) {
|
protected function renderDirectoryReadme(DiffusionBrowseResultSet $browse) {
|
||||||
$readme_path = $browse->getReadmePath();
|
$readme_path = $browse->getReadmePath();
|
||||||
if ($readme_path === null) {
|
if ($readme_path === null) {
|
||||||
|
@ -470,15 +502,15 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
|
|
||||||
$view->addMenuItem(
|
$view->addMenuItem(
|
||||||
id(new PHUIListItemView())
|
id(new PHUIListItemView())
|
||||||
->setKey('home')
|
->setKey('code')
|
||||||
->setName(pht('Home'))
|
->setName(pht('Code'))
|
||||||
->setIcon('fa-home')
|
->setIcon('fa-code')
|
||||||
->setHref($drequest->generateURI(
|
->setHref($drequest->generateURI(
|
||||||
array(
|
array(
|
||||||
'action' => 'branch',
|
'action' => 'branch',
|
||||||
'path' => '/',
|
'path' => '/',
|
||||||
)))
|
)))
|
||||||
->setSelected($key == 'home'));
|
->setSelected($key == 'code'));
|
||||||
|
|
||||||
if (!$repository->isSVN()) {
|
if (!$repository->isSVN()) {
|
||||||
$view->addMenuItem(
|
$view->addMenuItem(
|
||||||
|
|
|
@ -11,6 +11,7 @@ final class DiffusionGraphController extends DiffusionController {
|
||||||
if ($response) {
|
if ($response) {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
require_celerity_resource('diffusion-css');
|
||||||
|
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
|
@ -83,6 +84,7 @@ final class DiffusionGraphController extends DiffusionController {
|
||||||
|
|
||||||
private function buildHeader(DiffusionRequest $drequest) {
|
private function buildHeader(DiffusionRequest $drequest) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
$no_path = !strlen($drequest->getPath());
|
$no_path = !strlen($drequest->getPath());
|
||||||
if ($no_path) {
|
if ($no_path) {
|
||||||
|
@ -96,6 +98,11 @@ final class DiffusionGraphController extends DiffusionController {
|
||||||
->setHeader($header_text)
|
->setHeader($header_text)
|
||||||
->setHeaderIcon('fa-code-fork');
|
->setHeaderIcon('fa-code-fork');
|
||||||
|
|
||||||
|
if (!$repository->isSVN()) {
|
||||||
|
$branch_tag = $this->renderBranchTag($drequest);
|
||||||
|
$header->addTag($branch_tag);
|
||||||
|
}
|
||||||
|
|
||||||
return $header;
|
return $header;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ final class DiffusionHistoryController extends DiffusionController {
|
||||||
if ($response) {
|
if ($response) {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
require_celerity_resource('diffusion-css');
|
||||||
|
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
|
@ -78,6 +79,7 @@ final class DiffusionHistoryController extends DiffusionController {
|
||||||
|
|
||||||
private function buildHeader(DiffusionRequest $drequest) {
|
private function buildHeader(DiffusionRequest $drequest) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
$no_path = !strlen($drequest->getPath());
|
$no_path = !strlen($drequest->getPath());
|
||||||
if ($no_path) {
|
if ($no_path) {
|
||||||
|
@ -91,6 +93,16 @@ final class DiffusionHistoryController extends DiffusionController {
|
||||||
->setHeader($header_text)
|
->setHeader($header_text)
|
||||||
->setHeaderIcon('fa-clock-o');
|
->setHeaderIcon('fa-clock-o');
|
||||||
|
|
||||||
|
if (!$repository->isSVN()) {
|
||||||
|
$branch_tag = $this->renderBranchTag($drequest);
|
||||||
|
$header->addTag($branch_tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($drequest->getSymbolicCommit()) {
|
||||||
|
$symbolic_tag = $this->renderSymbolicCommit($drequest);
|
||||||
|
$header->addTag($symbolic_tag);
|
||||||
|
}
|
||||||
|
|
||||||
return $header;
|
return $header;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||||
->setErrors(array($empty_message));
|
->setErrors(array($empty_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabs = $this->buildTabsView('home');
|
$tabs = $this->buildTabsView('code');
|
||||||
|
|
||||||
$clone_uri = $drequest->generateURI(
|
$clone_uri = $drequest->generateURI(
|
||||||
array(
|
array(
|
||||||
|
@ -300,6 +300,7 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||||
|
|
||||||
private function buildHeaderView(PhabricatorRepository $repository) {
|
private function buildHeaderView(PhabricatorRepository $repository) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
$drequest = $this->getDiffusionRequest();
|
||||||
$search = $this->renderSearchForm();
|
$search = $this->renderSearchForm();
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
$header = id(new PHUIHeaderView())
|
||||||
|
@ -325,6 +326,14 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||||
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
|
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$repository->isSVN()) {
|
||||||
|
$default = $repository->getDefaultBranch();
|
||||||
|
if ($default != $drequest->getBranch()) {
|
||||||
|
$branch_tag = $this->renderBranchTag($drequest);
|
||||||
|
$header->addTag($branch_tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ final class DiffusionTagListController extends DiffusionController {
|
||||||
if ($response) {
|
if ($response) {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
require_celerity_resource('diffusion-css');
|
||||||
|
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
|
@ -50,6 +51,11 @@ final class DiffusionTagListController extends DiffusionController {
|
||||||
->setHeader(pht('Tags'))
|
->setHeader(pht('Tags'))
|
||||||
->setHeaderIcon('fa-tags');
|
->setHeaderIcon('fa-tags');
|
||||||
|
|
||||||
|
if (!$repository->isSVN()) {
|
||||||
|
$branch_tag = $this->renderBranchTag($drequest);
|
||||||
|
$header->addTag($branch_tag);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$tags) {
|
if (!$tags) {
|
||||||
$content = $this->renderStatusMessage(
|
$content = $this->renderStatusMessage(
|
||||||
pht('No Tags'),
|
pht('No Tags'),
|
||||||
|
|
|
@ -122,6 +122,12 @@
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.diffusion-header-branch-tag.phui-tag-view.phui-tag-type-outline
|
||||||
|
.phui-tag-core {
|
||||||
|
padding: 3px 12px 2px;
|
||||||
|
font-size: {$normalfontsize};
|
||||||
|
}
|
||||||
|
|
||||||
/* - Browse Styles ----------------------------------------------------------*/
|
/* - Browse Styles ----------------------------------------------------------*/
|
||||||
|
|
||||||
.diffusion-browse-table .commit-detail {
|
.diffusion-browse-table .commit-detail {
|
||||||
|
|
Loading…
Reference in a new issue