From c51f45fbcd135cb88643d21905402bb0cf756838 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 10 Apr 2013 13:08:36 -0700 Subject: [PATCH] Add actions to mobile crumbs Summary: Adds in the ActionList into Crumbs for mobile on many applications. Test Plan: Tested each application except probably drydock since not sure how to test that. Also cleaned up Ponder a little. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5648 --- .../controller/DrydockLeaseViewController.php | 1 + .../DrydockResourceViewController.php | 1 + .../PhabricatorFileInfoController.php | 15 ++++---- .../PhabricatorMacroViewController.php | 3 +- .../PhabricatorPasteViewController.php | 1 + .../controller/PholioMockViewController.php | 1 + .../PhortuneAccountViewController.php | 2 ++ .../PhortuneProductViewController.php | 21 ++++++------ .../PhrictionDocumentController.php | 5 +-- .../ponder/controller/PonderController.php | 34 +++++++++---------- .../controller/PonderFeedController.php | 1 + .../PonderQuestionViewController.php | 9 ++++- src/view/layout/PhabricatorCrumbsView.php | 2 +- 13 files changed, 56 insertions(+), 40 deletions(-) diff --git a/src/applications/drydock/controller/DrydockLeaseViewController.php b/src/applications/drydock/controller/DrydockLeaseViewController.php index ac634b9ccc..a0508de6c3 100644 --- a/src/applications/drydock/controller/DrydockLeaseViewController.php +++ b/src/applications/drydock/controller/DrydockLeaseViewController.php @@ -39,6 +39,7 @@ final class DrydockLeaseViewController extends DrydockController { $log_table->appendChild($pager); $crumbs = $this->buildApplicationCrumbs(); + $crumbs->setActionList($actions); $crumbs->addCrumb( id(new PhabricatorCrumbView()) ->setName($title) diff --git a/src/applications/drydock/controller/DrydockResourceViewController.php b/src/applications/drydock/controller/DrydockResourceViewController.php index 33dcf38514..45ed050c58 100644 --- a/src/applications/drydock/controller/DrydockResourceViewController.php +++ b/src/applications/drydock/controller/DrydockResourceViewController.php @@ -51,6 +51,7 @@ final class DrydockResourceViewController extends DrydockController { $log_table->appendChild($pager); $crumbs = $this->buildApplicationCrumbs(); + $crumbs->setActionList($actions); $crumbs->addCrumb( id(new PhabricatorCrumbView()) ->setName(pht('Resource %d', $resource->getID()))); diff --git a/src/applications/files/controller/PhabricatorFileInfoController.php b/src/applications/files/controller/PhabricatorFileInfoController.php index 14957f0314..20126841b4 100644 --- a/src/applications/files/controller/PhabricatorFileInfoController.php +++ b/src/applications/files/controller/PhabricatorFileInfoController.php @@ -22,15 +22,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController { } $this->loadHandles(array($file->getAuthorPHID())); - $phid = $file->getPHID(); - - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addCrumb( - id(new PhabricatorCrumbView()) - ->setName('F'.$file->getID()) - ->setHref($this->getApplicationURI("/info/{$phid}/"))); - $header = id(new PhabricatorHeaderView()) ->setHeader($file->getName()); @@ -45,6 +37,13 @@ final class PhabricatorFileInfoController extends PhabricatorFileController { $actions = $this->buildActionView($file); $properties = $this->buildPropertyView($file); + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->setActionList($actions); + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName('F'.$file->getID()) + ->setHref($this->getApplicationURI("/info/{$phid}/"))); + return $this->buildApplicationPage( array( $crumbs, diff --git a/src/applications/macro/controller/PhabricatorMacroViewController.php b/src/applications/macro/controller/PhabricatorMacroViewController.php index 4b9e9b569b..15c6d52163 100644 --- a/src/applications/macro/controller/PhabricatorMacroViewController.php +++ b/src/applications/macro/controller/PhabricatorMacroViewController.php @@ -30,14 +30,15 @@ final class PhabricatorMacroViewController $macro->getPHID()); $this->loadHandles($subscribers); + $actions = $this->buildActionView($macro); $crumbs = $this->buildApplicationCrumbs(); + $crumbs->setActionList($actions); $crumbs->addCrumb( id(new PhabricatorCrumbView()) ->setHref($this->getApplicationURI('/view/'.$macro->getID().'/')) ->setName($title_short)); - $actions = $this->buildActionView($macro); $properties = $this->buildPropertyView($macro, $file, $subscribers); $xactions = id(new PhabricatorMacroTransactionQuery()) diff --git a/src/applications/paste/controller/PhabricatorPasteViewController.php b/src/applications/paste/controller/PhabricatorPasteViewController.php index 2a12939c4e..85db9938df 100644 --- a/src/applications/paste/controller/PhabricatorPasteViewController.php +++ b/src/applications/paste/controller/PhabricatorPasteViewController.php @@ -53,6 +53,7 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController { $source_code = $this->buildSourceCodeView($paste); $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()) + ->setActionList($actions) ->addCrumb( id(new PhabricatorCrumbView()) ->setName('P'.$paste->getID()) diff --git a/src/applications/pholio/controller/PholioMockViewController.php b/src/applications/pholio/controller/PholioMockViewController.php index d64e5b4efb..b34d48087e 100644 --- a/src/applications/pholio/controller/PholioMockViewController.php +++ b/src/applications/pholio/controller/PholioMockViewController.php @@ -85,6 +85,7 @@ final class PholioMockViewController extends PholioController { $add_comment = $this->buildAddCommentView($mock); $crumbs = $this->buildApplicationCrumbs($this->buildSideNav()); + $crumbs->setActionList($actions); $crumbs->addCrumb( id(new PhabricatorCrumbView()) ->setName('M'.$mock->getID()) diff --git a/src/applications/phortune/controller/PhortuneAccountViewController.php b/src/applications/phortune/controller/PhortuneAccountViewController.php index 41ece1b6d7..63cad02280 100644 --- a/src/applications/phortune/controller/PhortuneAccountViewController.php +++ b/src/applications/phortune/controller/PhortuneAccountViewController.php @@ -47,6 +47,8 @@ final class PhortuneAccountViewController extends PhortuneController { ->setHref('#') ->setDisabled(true)); + $crumbs->setActionList($actions); + $properties = id(new PhabricatorPropertyListView()) ->setObject($account) ->setUser($user); diff --git a/src/applications/phortune/controller/PhortuneProductViewController.php b/src/applications/phortune/controller/PhortuneProductViewController.php index 907ea25802..dbabf8303d 100644 --- a/src/applications/phortune/controller/PhortuneProductViewController.php +++ b/src/applications/phortune/controller/PhortuneProductViewController.php @@ -23,16 +23,6 @@ final class PhortuneProductViewController extends PhabricatorController { $title = pht('Product: %s', $product->getProductName()); - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addCrumb( - id(new PhabricatorCrumbView()) - ->setName(pht('Products')) - ->setHref($this->getApplicationURI('product/'))); - $crumbs->addCrumb( - id(new PhabricatorCrumbView()) - ->setName(pht('#%d', $product->getID())) - ->setHref($request->getRequestURI())); - $header = id(new PhabricatorHeaderView()) ->setHeader($product->getProductName()); @@ -46,6 +36,17 @@ final class PhortuneProductViewController extends PhabricatorController { ->setHref($edit_uri) ->setIcon('edit')); + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->setActionList($actions); + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName(pht('Products')) + ->setHref($this->getApplicationURI('product/'))); + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName(pht('#%d', $product->getID())) + ->setHref($request->getRequestURI())); + $properties = id(new PhabricatorPropertyListView()) ->setUser($user) ->addProperty(pht('Type'), $product->getTypeName()) diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index 3c206e0527..633c87638b 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -224,14 +224,15 @@ final class PhrictionDocumentController $children = $this->renderDocumentChildren($slug); + $actions = $this->buildActionView($user, $document); + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->setActionList($actions); $crumb_views = $this->renderBreadcrumbs($slug); foreach ($crumb_views as $view) { $crumbs->addCrumb($view); } - $actions = $this->buildActionView($user, $document); - $header = id(new PhabricatorHeaderView()) ->setHeader($page_title); diff --git a/src/applications/ponder/controller/PonderController.php b/src/applications/ponder/controller/PonderController.php index 7b29d98955..037cf0bcbd 100644 --- a/src/applications/ponder/controller/PonderController.php +++ b/src/applications/ponder/controller/PonderController.php @@ -5,7 +5,7 @@ abstract class PonderController extends PhabricatorController { public function buildStandardPageResponse($view, array $data) { $page = $this->buildStandardPageView(); - $page->setApplicationName('Ponder!'); + $page->setApplicationName(pht('Ponder!')); $page->setBaseURI('/ponder/'); $page->setTitle(idx($data, 'title')); $page->setGlyph("\xE2\x97\xB3"); @@ -20,24 +20,24 @@ abstract class PonderController extends PhabricatorController { $side_nav = new AphrontSideNavFilterView(); $side_nav->setBaseURI(new PhutilURI($this->getApplicationURI())); - if ($question && $question->getID()) { - $side_nav->addFilter( - null, - 'Q'.$question->getID(), - 'Q'.$question->getID()); - } - - $side_nav->addLabel('Create'); - $side_nav->addFilter('question/ask', 'Ask a Question'); - - $side_nav->addLabel('Questions'); - $side_nav->addFilter('feed', 'All Questions'); - - $side_nav->addLabel('User'); - $side_nav->addFilter('questions', 'Your Questions'); - $side_nav->addFilter('answers', 'Your Answers'); + $side_nav->addLabel(pht('Questions')); + $side_nav->addFilter('feed', pht('All Questions')); + $side_nav->addFilter('questions', pht('Your Questions')); + $side_nav->addFilter('answers', pht('Your Answers')); return $side_nav; } + public function buildApplicationCrumbs() { + $crumbs = parent::buildApplicationCrumbs(); + $crumbs + ->addAction( + id(new PhabricatorMenuItemView()) + ->setName(pht('New Question')) + ->setHref('question/ask') + ->setIcon('create')); + + return $crumbs; + } + } diff --git a/src/applications/ponder/controller/PonderFeedController.php b/src/applications/ponder/controller/PonderFeedController.php index e3f468f500..e669e05a54 100644 --- a/src/applications/ponder/controller/PonderFeedController.php +++ b/src/applications/ponder/controller/PonderFeedController.php @@ -80,6 +80,7 @@ final class PonderFeedController extends PonderController { array( 'device' => true, 'title' => $title, + 'dust' => true, )); } diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php index 0526d30d7b..758a0a6673 100644 --- a/src/applications/ponder/controller/PonderQuestionViewController.php +++ b/src/applications/ponder/controller/PonderQuestionViewController.php @@ -64,15 +64,22 @@ final class PonderQuestionViewController extends PonderController { ->setActionURI("/ponder/answer/add/"); $header = id(new PhabricatorHeaderView()) - ->setObjectName('Q'.$question->getID()) ->setHeader($question->getTitle()); $actions = $this->buildActionListView($question); $properties = $this->buildPropertyListView($question, $subscribers); + $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()); + $crumbs->setActionList($actions); + $crumbs->addCrumb( + id(new PhabricatorCrumbView()) + ->setName('Q'.$this->questionID) + ->setHref('/Q'.$this->questionID)); + $nav = $this->buildSideNavView($question); $nav->appendChild( array( + $crumbs, $header, $actions, $properties, diff --git a/src/view/layout/PhabricatorCrumbsView.php b/src/view/layout/PhabricatorCrumbsView.php index 95441c8282..c3ad77a222 100644 --- a/src/view/layout/PhabricatorCrumbsView.php +++ b/src/view/layout/PhabricatorCrumbsView.php @@ -30,7 +30,7 @@ final class PhabricatorCrumbsView extends AphrontView { require_celerity_resource('phabricator-crumbs-view-css'); $action_view = null; - if ($this->actions) { + if (($this->actions) || ($this->actionListID)) { $actions = array(); foreach ($this->actions as $action) { $icon = null;