@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Restore old Home mobile menu behavior, hide crumbs

Summary:
Ref T12174.

- Go back to the old mobile behavior (full-screen menu by default, click to see content).
- Hide crumbs from all Home content UIs. I left them on the edit/configure UIs since they feel a little less out-of-place there and some have multiple levels.

Test Plan:
Viewed Home on mobile, viewed `/home/` on mobile.

Also, saw no crumbs.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12174

Differential Revision: https://secure.phabricator.com/D17290

+49 -10
+6 -1
src/applications/home/application/PhabricatorHomeApplication.php
··· 23 23 public function getRoutes() { 24 24 return array( 25 25 '/' => 'PhabricatorHomeMenuItemController', 26 - '/home/' => array( 26 + 27 + // NOTE: If you visit "/" on mobile, you get just the menu. If you visit 28 + // "/home/" on mobile, you get the content. From the normal desktop 29 + // UI, there's no difference between these pages. 30 + 31 + '/(?P<content>home)/' => array( 27 32 '' => 'PhabricatorHomeMenuItemController', 28 33 'menu/' => $this->getProfileMenuRouting( 29 34 'PhabricatorHomeMenuItemController'),
+11 -1
src/applications/home/controller/PhabricatorHomeMenuItemController.php
··· 14 14 public function handleRequest(AphrontRequest $request) { 15 15 $viewer = $this->getViewer(); 16 16 17 + // Test if we should show mobile users the menu or the page content: 18 + // if you visit "/", you just get the menu. If you visit "/home/", you 19 + // get the content. 20 + $is_content = $request->getURIData('content'); 21 + 17 22 $application = 'PhabricatorHomeApplication'; 18 23 $home_app = id(new PhabricatorApplicationQuery()) 19 24 ->setViewer($viewer) ··· 24 29 $engine = id(new PhabricatorHomeProfileMenuEngine()) 25 30 ->setProfileObject($home_app) 26 31 ->setCustomPHID($viewer->getPHID()) 27 - ->setController($this); 32 + ->setController($this) 33 + ->setShowContentCrumbs(false); 34 + 35 + if (!$is_content) { 36 + $engine->addContentPageClass('phabricator-home'); 37 + } 28 38 29 39 return $engine->buildResponse(); 30 40 }
+32 -8
src/applications/search/engine/PhabricatorProfileMenuEngine.php
··· 11 11 private $navigation; 12 12 private $showNavigation = true; 13 13 private $editMode; 14 + private $pageClasses = array(); 15 + private $showContentCrumbs = true; 14 16 15 17 const ITEM_CUSTOM_DIVIDER = 'engine.divider'; 16 18 const ITEM_MANAGE = 'item.configure'; ··· 90 92 return $this->showNavigation; 91 93 } 92 94 95 + public function addContentPageClass($class) { 96 + $this->pageClasses[] = $class; 97 + return $this; 98 + } 99 + 100 + public function setShowContentCrumbs($show_content_crumbs) { 101 + $this->showContentCrumbs = $show_content_crumbs; 102 + return $this; 103 + } 104 + 105 + public function getShowContentCrumbs() { 106 + return $this->showContentCrumbs; 107 + } 108 + 93 109 abstract public function getItemURI($path); 94 110 abstract protected function isMenuEngineConfigurable(); 95 111 ··· 118 134 $item_action = 'view'; 119 135 } 120 136 137 + $is_view = ($item_action == 'view'); 138 + 121 139 // If the engine is not configurable, don't respond to any of the editing 122 140 // or configuration routes. 123 141 if (!$this->isMenuEngineConfigurable()) { 124 - switch ($item_action) { 125 - case 'view': 126 - break; 127 - default: 128 - return new Aphront404Response(); 142 + if (!$is_view) { 143 + return new Aphront404Response(); 129 144 } 130 145 } 131 146 ··· 159 174 } 160 175 161 176 if (!$selected_item) { 162 - if ($item_action == 'view') { 177 + if ($is_view) { 163 178 $selected_item = $this->getDefaultItem(); 164 179 } 165 180 } ··· 190 205 191 206 $crumbs = $controller->buildApplicationCrumbsForEditEngine(); 192 207 193 - if ($item_action != 'view') { 208 + if (!$is_view) { 194 209 $navigation->selectFilter(self::ITEM_MANAGE); 195 210 196 211 if ($selected_item) { ··· 298 313 299 314 $page = $controller->newPage() 300 315 ->setTitle($page_title) 301 - ->setCrumbs($crumbs) 302 316 ->appendChild($content); 303 317 318 + if (!$is_view || $this->getShowContentCrumbs()) { 319 + $page->setCrumbs($crumbs); 320 + } 321 + 304 322 if ($this->getShowNavigation()) { 305 323 $page->setNavigation($navigation); 324 + } 325 + 326 + if ($is_view) { 327 + foreach ($this->pageClasses as $class) { 328 + $page->addClass($class); 329 + } 306 330 } 307 331 308 332 return $page;