diff --git a/src/applications/diviner/controller/DivinerBookController.php b/src/applications/diviner/controller/DivinerBookController.php index 11d6a5bbfc..74b2a8f3d9 100644 --- a/src/applications/diviner/controller/DivinerBookController.php +++ b/src/applications/diviner/controller/DivinerBookController.php @@ -29,20 +29,12 @@ final class DivinerBookController extends DivinerController { $book->getShortTitle(), '/book/'.$book->getName().'/'); - $action_button = id(new PHUIButtonView()) - ->setTag('a') - ->setText(pht('Actions')) - ->setHref('#') - ->setIcon('fa-bars') - ->addClass('phui-mobile-menu') - ->setDropdownMenu($actions); - $header = id(new PHUIHeaderView()) ->setHeader($book->getTitle()) ->setUser($viewer) ->setPolicyObject($book) ->setEpoch($book->getDateModified()) - ->addActionLink($action_button); + ->setActionList($actions); // TODO: This could probably look better. if ($book->getRepositoryPHID()) { diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php index 60972c57b8..ea0822b856 100644 --- a/src/applications/phame/controller/blog/PhameBlogViewController.php +++ b/src/applications/phame/controller/blog/PhameBlogViewController.php @@ -44,16 +44,7 @@ final class PhameBlogViewController extends PhameLiveController { $header->setStatus($header_icon, $header_color, $header_name); $actions = $this->renderActions($blog); - $action_button = id(new PHUIButtonView()) - ->setTag('a') - ->setText(pht('Actions')) - ->setHref('#') - ->setIcon('fa-bars') - ->addClass('phui-mobile-menu') - ->setDropdownMenu($actions); - - $header->addActionLink($action_button); - + $header->setActionList($actions); $header->setPolicyObject($blog); } diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php index 537bfbb713..a4231cc1ac 100644 --- a/src/applications/phame/controller/post/PhamePostViewController.php +++ b/src/applications/phame/controller/post/PhamePostViewController.php @@ -24,17 +24,8 @@ final class PhamePostViewController if (!$is_external) { $actions = $this->renderActions($post); - - $action_button = id(new PHUIButtonView()) - ->setTag('a') - ->setText(pht('Actions')) - ->setHref('#') - ->setIcon('fa-bars') - ->addClass('phui-mobile-menu') - ->setDropdownMenu($actions); - $header->setPolicyObject($post); - $header->addActionLink($action_button); + $header->setActionList($actions); } $document = id(new PHUIDocumentViewPro()) diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index 7d98e9ed3b..7dae0fad03 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -203,19 +203,11 @@ final class PhrictionDocumentController $crumbs->addCrumb($view); } - $action_button = id(new PHUIButtonView()) - ->setTag('a') - ->setText(pht('Actions')) - ->setHref('#') - ->setIcon('fa-bars') - ->addClass('phui-mobile-menu') - ->setDropdownMenu($actions); - $header = id(new PHUIHeaderView()) ->setUser($viewer) ->setPolicyObject($document) ->setHeader($page_title) - ->addActionLink($action_button); + ->setActionList($actions); if ($content) { $header->setEpoch($content->getDateCreated()); diff --git a/src/view/phui/PHUIHeaderView.php b/src/view/phui/PHUIHeaderView.php index 50f0e36317..233e5a7c72 100644 --- a/src/view/phui/PHUIHeaderView.php +++ b/src/view/phui/PHUIHeaderView.php @@ -23,6 +23,7 @@ final class PHUIHeaderView extends AphrontTagView { private $actionIcons = array(); private $badges = array(); private $href; + private $actionList; public function setHeader($header) { $this->header = $header; @@ -84,6 +85,11 @@ final class PHUIHeaderView extends AphrontTagView { return $this; } + public function setActionList(PhabricatorActionListView $list) { + $this->actionList = $list; + return $this; + } + public function setPolicyObject(PhabricatorPolicyInterface $object) { $this->policyObject = $object; return $this; @@ -191,6 +197,17 @@ final class PHUIHeaderView extends AphrontTagView { protected function getTagContent() { + if ($this->actionList) { + $action_button = id(new PHUIButtonView()) + ->setTag('a') + ->setText(pht('Actions')) + ->setHref('#') + ->setIcon('fa-bars') + ->addClass('phui-mobile-menu') + ->setDropdownMenu($this->actionList); + $this->addActionLink($action_button); + } + $image = null; if ($this->image) { $image_href = null;