mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Make "Favorites" work more like other customizable menus
Summary: Depends on D20373. Ref T13272. When you put Dashboards in Favorites, the render without a navigation menu, which is kind of weird. Instead, make Favorites display a navigation menu. This effectively turns it into a weird cross between the home page and a portal, but so be it. Also change the icon from "star" to "bookmark" since I think that a clearer hint about how it works. Test Plan: Viewed dashboards in favorites, got a navigation menu. Edited items from portals, home, favorites. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13272 Differential Revision: https://secure.phabricator.com/D20374
This commit is contained in:
parent
a1a89589b1
commit
4d0904ef95
7 changed files with 32 additions and 33 deletions
|
@ -20,6 +20,8 @@ final class PhabricatorDashboardPortalProfileMenuEngine
|
|||
protected function getBuiltinProfileItems($object) {
|
||||
$items = array();
|
||||
|
||||
$items[] = $this->newDividerItem('tail');
|
||||
|
||||
$items[] = $this->newManageItem();
|
||||
|
||||
$items[] = $this->newItem()
|
||||
|
|
|
@ -15,12 +15,13 @@ final class PhabricatorFavoritesApplication extends PhabricatorApplication {
|
|||
}
|
||||
|
||||
public function getIcon() {
|
||||
return 'fa-star';
|
||||
return 'fa-bookmark';
|
||||
}
|
||||
|
||||
public function getRoutes() {
|
||||
return array(
|
||||
'/favorites/' => array(
|
||||
'' => 'PhabricatorFavoritesMenuItemController',
|
||||
'menu/' => $this->getProfileMenuRouting(
|
||||
'PhabricatorFavoritesMenuItemController'),
|
||||
),
|
||||
|
|
|
@ -16,8 +16,7 @@ final class PhabricatorFavoritesMenuItemController
|
|||
$engine = id(new PhabricatorFavoritesProfileMenuEngine())
|
||||
->setProfileObject($favorites)
|
||||
->setCustomPHID($viewer->getPHID())
|
||||
->setController($this)
|
||||
->setShowNavigation(false);
|
||||
->setController($this);
|
||||
|
||||
return $engine->buildResponse();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,10 @@ final class PhabricatorFavoritesProfileMenuEngine
|
|||
}
|
||||
}
|
||||
|
||||
$items[] = $this->newDividerItem('tail');
|
||||
$items[] = $this->newManageItem()
|
||||
->setMenuItemProperty('name', pht('Edit Favorites'));
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ final class PhabricatorFavoritesMainMenuBarExtension
|
|||
$favorites_menu = id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setHref('#')
|
||||
->setIcon('fa-star')
|
||||
->setIcon('fa-bookmark')
|
||||
->addClass('phabricator-core-user-menu')
|
||||
->setNoCSS(true)
|
||||
->setDropdown(true)
|
||||
|
@ -71,20 +71,11 @@ final class PhabricatorFavoritesMainMenuBarExtension
|
|||
$action = id(new PhabricatorActionView())
|
||||
->setName($item->getName())
|
||||
->setHref($item->getHref())
|
||||
->setIcon($item->getIcon())
|
||||
->setType($item->getType());
|
||||
$view->addAction($action);
|
||||
}
|
||||
|
||||
if ($viewer->isLoggedIn()) {
|
||||
$view->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setType(PhabricatorActionView::TYPE_DIVIDER));
|
||||
$view->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('Edit Favorites'))
|
||||
->setHref('/favorites/menu/configure/'));
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,11 +67,12 @@ final class PhabricatorHomeProfileMenuEngine
|
|||
->setMenuItemProperties($properties);
|
||||
}
|
||||
|
||||
// Hotlink to More Applications Launcher...
|
||||
$items[] = $this->newItem()
|
||||
->setBuiltinKey(PhabricatorHomeConstants::ITEM_LAUNCHER)
|
||||
->setMenuItemKey(PhabricatorHomeLauncherProfileMenuItem::MENUITEMKEY);
|
||||
|
||||
$items[] = $this->newDividerItem('tail');
|
||||
|
||||
$items[] = $this->newManageItem();
|
||||
|
||||
return $items;
|
||||
|
|
|
@ -8,7 +8,6 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
|
|||
private $items;
|
||||
private $controller;
|
||||
private $navigation;
|
||||
private $showNavigation = true;
|
||||
private $editMode;
|
||||
private $pageClasses = array();
|
||||
private $showContentCrumbs = true;
|
||||
|
@ -71,15 +70,6 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
|
|||
return $this->controller;
|
||||
}
|
||||
|
||||
public function setShowNavigation($show) {
|
||||
$this->showNavigation = $show;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShowNavigation() {
|
||||
return $this->showNavigation;
|
||||
}
|
||||
|
||||
public function addContentPageClass($class) {
|
||||
$this->pageClasses[] = $class;
|
||||
return $this;
|
||||
|
@ -181,13 +171,19 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
|
|||
$crumbs = $controller->buildApplicationCrumbsForEditEngine();
|
||||
|
||||
if (!$is_view) {
|
||||
$edit_mode = null;
|
||||
|
||||
if ($selected_item) {
|
||||
if ($selected_item->getCustomPHID()) {
|
||||
$edit_mode = 'custom';
|
||||
} else {
|
||||
$edit_mode = 'global';
|
||||
if ($selected_item->getBuiltinKey() !== self::ITEM_MANAGE) {
|
||||
if ($selected_item->getCustomPHID()) {
|
||||
$edit_mode = 'custom';
|
||||
} else {
|
||||
$edit_mode = 'global';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if ($edit_mode === null) {
|
||||
$edit_mode = $request->getURIData('itemEditMode');
|
||||
}
|
||||
|
||||
|
@ -309,9 +305,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
|
|||
$page->setCrumbs($crumbs);
|
||||
}
|
||||
|
||||
if ($this->getShowNavigation()) {
|
||||
$page->setNavigation($navigation);
|
||||
}
|
||||
$page->setNavigation($navigation);
|
||||
|
||||
if ($is_view) {
|
||||
foreach ($this->pageClasses as $class) {
|
||||
|
@ -1133,6 +1127,13 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
|
|||
->setIsTailItem(true);
|
||||
}
|
||||
|
||||
protected function newDividerItem($key) {
|
||||
return $this->newItem()
|
||||
->setBuiltinKey($key)
|
||||
->setMenuItemKey(PhabricatorDividerProfileMenuItem::MENUITEMKEY)
|
||||
->setIsTailItem(true);
|
||||
}
|
||||
|
||||
public function getDefaultMenuItemConfiguration() {
|
||||
$configs = $this->getItems();
|
||||
foreach ($configs as $config) {
|
||||
|
|
Loading…
Reference in a new issue