1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 11:12:42 +01:00
phorge-phorge/src/applications/home/controller/PhabricatorHomeQuickCreateController.php
epriestley 7969f66dfe Fully modularize the "Quick Actions" menu
Summary:
Ref T10077. Currently, we issue 6+ queries on every page to build this menu, since the menu is built application-by-application.

Build the menu with dedicated modules instead so a single "EditEngine" module can provide all of them with one query.

I'd like to reduce this to 0 queries but I'm not totally sure what we want to do with this menu.

This change removes these items, because EditEngine can not currently provide them:

  - Calendar: Eventually via EditEngine eventually.
  - Conpherence: Probably via EditEngine, doesn't seem too important.
  - People: Maybe via EditEngine, doesn't seem too important? "Welcome" is likely better?
  - Pholio: Eventually via EditEngine.

It adds a bunch of other items as a side effect:

{F1677151}

This reduces the queries issued on every page by ~5.

This also makes quick create actions visible while logged out (see T7073).

Test Plan:
  - Viewed menu while logged in.
  - Viewed menu while logged out.
  - Viewed standalone version of menu.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10077

Differential Revision: https://secure.phabricator.com/D16045
2016-06-05 10:32:01 -07:00

47 lines
1.1 KiB
PHP

<?php
final class PhabricatorHomeQuickCreateController
extends PhabricatorHomeController {
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$items = PhabricatorQuickActions::loadMenuItemsForUser($viewer);
$list = id(new PHUIObjectItemListView())
->setUser($viewer);
foreach ($items as $item) {
$list->addItem(
id(new PHUIObjectItemView())
->setHeader($item->getName())
->setWorkflow($item->getWorkflow())
->setHref($item->getHref()));
}
$title = pht('Quick Create');
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Quick Create'));
$crumbs->setBorder(true);
$box = id(new PHUIObjectBoxView())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setObjectList($list);
$header = id(new PHUIHeaderView())
->setHeader($title)
->setHeaderIcon('fa-plus-square');
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter($box);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
}