Add a breadcrumbs element
Summary:
Add a basic breadcrumbs element, and implement it in Paste.
This needs some polish but is most of the way there.
Test Plan:
{F26443}
{F26444}
{F26445}
(This element is not visible on devices.)
Reviewers: chad
Reviewed By: chad
CC: aran, btrahan
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4087
This commit is contained in:
@@ -2,37 +2,41 @@
|
||||
|
||||
abstract class PhabricatorPasteController extends PhabricatorController {
|
||||
|
||||
public function buildSideNavView(PhabricatorPaste $paste = null) {
|
||||
public function buildSideNavView($filter = null, $for_app = false) {
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$nav = new AphrontSideNavFilterView();
|
||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('filter/')));
|
||||
|
||||
if ($paste) {
|
||||
$nav->addFilter('paste', 'P'.$paste->getID(), '/P'.$paste->getID());
|
||||
$nav->addSpacer();
|
||||
if ($for_app) {
|
||||
$nav->addFilter('', 'Create Paste', $this->getApplicationURI('/create/'));
|
||||
}
|
||||
|
||||
$nav->addLabel('Create');
|
||||
$nav->addFilter(
|
||||
'edit',
|
||||
'New Paste',
|
||||
$this->getApplicationURI(),
|
||||
$relative = false,
|
||||
$class = ($user->isLoggedIn() ? null : 'disabled'));
|
||||
|
||||
$nav->addSpacer();
|
||||
$nav->addLabel('Pastes');
|
||||
$nav->addLabel('Filters');
|
||||
$nav->addFilter('all', 'All Pastes');
|
||||
if ($user->isLoggedIn()) {
|
||||
$nav->addFilter('my', 'My Pastes');
|
||||
}
|
||||
$nav->addFilter('all', 'All Pastes');
|
||||
|
||||
$nav->selectFilter($filter, 'all');
|
||||
|
||||
return $nav;
|
||||
}
|
||||
|
||||
public function buildApplicationMenu() {
|
||||
return $this->buildSideNavView(null)->getMenu();
|
||||
return $this->buildSideNavView(null, true)->getMenu();
|
||||
}
|
||||
|
||||
public function buildApplicationCrumbs() {
|
||||
$crumbs = parent::buildApplicationCrumbs();
|
||||
|
||||
$crumbs->addAction(
|
||||
id(new PhabricatorMenuItemView())
|
||||
->setName(pht('Create Paste'))
|
||||
->setHref($this->getApplicationURI('create/'))
|
||||
->setIcon('create'));
|
||||
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user