From b80f5e910551d75a4ad260e1d66a454d808fc002 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 15 Feb 2013 10:17:31 -0800 Subject: [PATCH] Pholio touchups Summary: Added crumbs, phts some things, made mobile menus work. Test Plan: Review Pholio in sb and ios. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2531 Differential Revision: https://secure.phabricator.com/D4973 --- .../pholio/controller/PholioController.php | 26 ++++++++++++++++--- .../controller/PholioMockEditController.php | 3 ++- .../controller/PholioMockListController.php | 15 +++++++---- .../controller/PholioMockViewController.php | 9 ++++++- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/applications/pholio/controller/PholioController.php b/src/applications/pholio/controller/PholioController.php index e738ae7cf0..b91a6c1989 100644 --- a/src/applications/pholio/controller/PholioController.php +++ b/src/applications/pholio/controller/PholioController.php @@ -5,18 +5,36 @@ */ abstract class PholioController extends PhabricatorController { - public function buildSideNav() { + public function buildSideNav($filter = null, $for_app = false) { $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); - $nav->addLabel('Create'); - $nav->addFilter('new', pht('Create Mock')); - $nav->addLabel('Mocks'); $nav->addFilter('view/all', pht('All Mocks')); + if ($for_app) { + $nav->addFilter('new/', pht('Create Mock')); + } + return $nav; } + public function buildApplicationCrumbs() { + $crumbs = parent::buildApplicationCrumbs(); + + $crumbs->addAction( + id(new PhabricatorMenuItemView()) + ->setName(pht('Create Mock')) + ->setHref($this->getApplicationURI('new/')) + ->setIcon('create')); + + return $crumbs; + } + + public function buildApplicationMenu() { + return $this->buildSideNav(null, true)->getMenu(); + } + + } diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php index cfc1da1022..ae577497c2 100644 --- a/src/applications/pholio/controller/PholioMockEditController.php +++ b/src/applications/pholio/controller/PholioMockEditController.php @@ -87,7 +87,7 @@ final class PholioMockEditController extends PholioController { } if (!$files) { - $e_images = 'Required'; + $e_images = pht('Required'); $errors[] = pht('You must add at least one image to the mock.'); } else { $mock->setCoverPHID(head($files)->getPHID()); @@ -211,6 +211,7 @@ final class PholioMockEditController extends PholioController { $nav, array( 'title' => $title, + 'device' => true, )); } diff --git a/src/applications/pholio/controller/PholioMockListController.php b/src/applications/pholio/controller/PholioMockListController.php index 2e5a4351d5..eeaaf65382 100644 --- a/src/applications/pholio/controller/PholioMockListController.php +++ b/src/applications/pholio/controller/PholioMockListController.php @@ -25,7 +25,7 @@ final class PholioMockListController extends PholioController { switch ($filter) { case 'view/all': default: - $title = 'All Mocks'; + $title = pht('All Mocks'); break; } @@ -44,21 +44,26 @@ final class PholioMockListController extends PholioController { ->setImageSize(220, 165)); } - $header = id(new PhabricatorHeaderView()) - ->setHeader($title); - $content = array( - $header, $board, $pager, ); $nav->appendChild($content); + $crumbs = $this->buildApplicationCrumbs($this->buildSideNav()); + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName($title) + ->setHref($this->getApplicationURI()) + ); + $nav->setCrumbs($crumbs); + return $this->buildApplicationPage( $nav, array( 'title' => $title, + 'device' => true, )); } diff --git a/src/applications/pholio/controller/PholioMockViewController.php b/src/applications/pholio/controller/PholioMockViewController.php index 927e03cdd1..d8dc11e27a 100644 --- a/src/applications/pholio/controller/PholioMockViewController.php +++ b/src/applications/pholio/controller/PholioMockViewController.php @@ -74,7 +74,15 @@ final class PholioMockViewController extends PholioController { $add_comment = $this->buildAddCommentView($mock); + $crumbs = $this->buildApplicationCrumbs($this->buildSideNav()); + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName($title) + ->setHref($this->getApplicationURI().'M'.$this->id) + ); + $content = array( + $crumbs, $header, $actions, $properties, @@ -83,7 +91,6 @@ final class PholioMockViewController extends PholioController { $add_comment, ); - return $this->buildApplicationPage( $content, array(