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:
epriestley
2012-12-07 13:35:17 -08:00
parent f910e38ecc
commit 1c9a6be979
18 changed files with 354 additions and 179 deletions

View File

@@ -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;
}
}