mirror of
https://we.phorge.it/source/phorge.git
synced 2025-04-10 19:38:34 +02:00
Summary: This does some backend cleanup of the tile stuff, and some general cleanup of other application things: - Users who haven't customized preferences get a small, specific set of pinned applications: Differential, Maniphest, Diffusion, Audit, Phriction, Projects (and, for administrators, Auth, Config and People). - Old tile size methods are replaced with `isPinnnedByDefault()`. - Shortened some short descriptions. - `shouldAppearInLaunchView()` replaced by less ambiguous `isLaunchable()`. - Added a marker for third-party / extension applications. Test Plan: Faked away my preferences and viewed the home page, saw a smaller set of default pins. Reviewers: chad Reviewed By: chad Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D9358
110 lines
2.5 KiB
PHP
110 lines
2.5 KiB
PHP
<?php
|
|
|
|
final class PhabricatorApplicationHome extends PhabricatorApplication {
|
|
|
|
public function getBaseURI() {
|
|
return '/';
|
|
}
|
|
|
|
public function getShortDescription() {
|
|
return pht('Where the <3 is');
|
|
}
|
|
|
|
public function getIconName() {
|
|
return 'home';
|
|
}
|
|
|
|
public function getRoutes() {
|
|
return array(
|
|
'/(?:(?P<filter>(?:jump))/)?' => 'PhabricatorHomeMainController',
|
|
'/home/' => array(
|
|
'create/' => 'PhabricatorHomeQuickCreateController',
|
|
),
|
|
);
|
|
}
|
|
|
|
public function isLaunchable() {
|
|
return false;
|
|
}
|
|
|
|
public function canUninstall() {
|
|
return false;
|
|
}
|
|
|
|
public function getApplicationOrder() {
|
|
return 9;
|
|
}
|
|
|
|
public function buildMainMenuItems(
|
|
PhabricatorUser $user,
|
|
PhabricatorController $controller = null) {
|
|
|
|
$items = array();
|
|
|
|
if ($user->isLoggedIn() && $user->isUserActivated()) {
|
|
$create_id = celerity_generate_unique_node_id();
|
|
Javelin::initBehavior(
|
|
'aphlict-dropdown',
|
|
array(
|
|
'bubbleID' => $create_id,
|
|
'dropdownID' => 'phabricator-quick-create-menu',
|
|
'local' => true,
|
|
'desktop' => true,
|
|
'right' => true,
|
|
));
|
|
|
|
$item = id(new PHUIListItemView())
|
|
->setName(pht('Create New...'))
|
|
->setIcon('new-sm')
|
|
->addClass('core-menu-item')
|
|
->setHref('/home/create/')
|
|
->addSigil('quick-create-menu')
|
|
->setID($create_id)
|
|
->setAural(pht('Quick Create'))
|
|
->setOrder(300);
|
|
$items[] = $item;
|
|
}
|
|
|
|
return $items;
|
|
}
|
|
|
|
public function loadAllQuickCreateItems(PhabricatorUser $viewer) {
|
|
$applications = id(new PhabricatorApplicationQuery())
|
|
->setViewer($viewer)
|
|
->withInstalled(true)
|
|
->execute();
|
|
|
|
$items = array();
|
|
foreach ($applications as $application) {
|
|
$app_items = $application->getQuickCreateItems($viewer);
|
|
foreach ($app_items as $app_item) {
|
|
$items[] = $app_item;
|
|
}
|
|
}
|
|
|
|
return $items;
|
|
}
|
|
|
|
public function buildMainMenuExtraNodes(
|
|
PhabricatorUser $viewer,
|
|
PhabricatorController $controller = null) {
|
|
|
|
$items = $this->loadAllQuickCreateItems($viewer);
|
|
|
|
$view = new PHUIListView();
|
|
$view->newLabel(pht('Create New...'));
|
|
foreach ($items as $item) {
|
|
$view->addMenuItem($item);
|
|
}
|
|
|
|
return phutil_tag(
|
|
'div',
|
|
array(
|
|
'id' => 'phabricator-quick-create-menu',
|
|
'class' => 'phabricator-main-menu-dropdown phui-list-sidenav',
|
|
'style' => 'display: none',
|
|
),
|
|
$view);
|
|
}
|
|
|
|
}
|