From 00faa2b2f7b5a8568866f2bb8ac058478256907c Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 19 Jan 2015 12:42:05 -0800 Subject: [PATCH] Fix mobile action menus in Phriction Summary: Fixes T6963. Long term will likely make this more like other document views, but not worth the time right now since this is only location. Test Plan: Review Phriction document at desktop and mobile breakpoints. Click menu and see menu. Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6963 Differential Revision: https://secure.phabricator.com/D11420 --- .../PhrictionDocumentController.php | 3 +++ src/view/phui/PHUIDocumentView.php | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index 13861efe71..fee9131896 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -200,11 +200,14 @@ final class PhrictionDocumentController $prop_list = new PHUIPropertyGroupView(); $prop_list->addPropertyList($properties); } + $action_id = celerity_generate_unique_node_id(); + $actions->setID($action_id); $page_content = id(new PHUIDocumentView()) ->setOffset(true) ->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS) ->setHeader($header) + ->setActionListID($action_id) ->appendChild( array( $actions, diff --git a/src/view/phui/PHUIDocumentView.php b/src/view/phui/PHUIDocumentView.php index d043da1e17..d8978fcf8a 100644 --- a/src/view/phui/PHUIDocumentView.php +++ b/src/view/phui/PHUIDocumentView.php @@ -16,6 +16,7 @@ final class PHUIDocumentView extends AphrontTagView { private $bookdescription; private $mobileview; private $fontKit; + private $actionListID; public function setOffset($offset) { $this->offset = $offset; @@ -57,6 +58,11 @@ final class PHUIDocumentView extends AphrontTagView { return $this; } + public function setActionListID($id) { + $this->actionListID = $id; + return $this; + } + protected function getTagAttributes() { $classes = array(); @@ -150,6 +156,27 @@ final class PHUIDocumentView extends AphrontTagView { $main_content = $this->renderChildren(); } + if ($this->actionListID) { + $icon_id = celerity_generate_unique_node_id(); + $icon = id(new PHUIIconView()) + ->setIconFont('fa-bars'); + $meta = array( + 'map' => array( + $this->actionListID => 'phabricator-action-list-toggle', + $icon_id => 'phuix-dropdown-open', + ),); + $mobile_menu = id(new PHUIButtonView()) + ->setTag('a') + ->setText(pht('Actions')) + ->setHref('#') + ->setIcon($icon) + ->addClass('phui-mobile-menu') + ->setID($icon_id) + ->addSigil('jx-toggle-class') + ->setMetadata($meta); + $this->header->addActionLink($mobile_menu); + } + $content_inner = phutil_tag( 'div', array(