1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

Fix getIcon calls in PHUIObjectListItem

Summary: Fixes T11501. Let's you pass in a full PHUIIconView or just the icon name to give ObjectListItem a large icon.

Test Plan: Alamanac, Applications, Drydock, Settings, Search Typeahead, Config page...

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T11501

Differential Revision: https://secure.phabricator.com/D16421
This commit is contained in:
Chad Little 2016-08-19 09:29:57 -07:00
parent 1ecce60589
commit e7aa874f5e
6 changed files with 17 additions and 30 deletions

View file

@ -16,7 +16,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView())
->setHeader(pht('Devices'))
->setHref($this->getApplicationURI('device/'))
->setIcon('fa-server')
->setImageIcon('fa-server')
->addAttribute(
pht(
'Create an inventory of physical and virtual hosts and '.
@ -26,7 +26,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView())
->setHeader(pht('Services'))
->setHref($this->getApplicationURI('service/'))
->setIcon('fa-plug')
->setImageIcon('fa-plug')
->addAttribute(
pht(
'Create and update services, and map them to interfaces on '.
@ -36,7 +36,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView())
->setHeader(pht('Networks'))
->setHref($this->getApplicationURI('network/'))
->setIcon('fa-globe')
->setImageIcon('fa-globe')
->addAttribute(
pht(
'Manage public and private networks.')));
@ -45,7 +45,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView())
->setHeader(pht('Namespaces'))
->setHref($this->getApplicationURI('namespace/'))
->setIcon('fa-asterisk')
->setImageIcon('fa-asterisk')
->addAttribute(
pht('Control who can create new named services and devices.')));
@ -56,7 +56,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView())
->setHeader(pht('Documentation'))
->setHref($docs_uri)
->setIcon('fa-book')
->setImageIcon('fa-book')
->addAttribute(pht('Browse documentation for Almanac.')));
$crumbs = $this->buildApplicationCrumbs();

View file

@ -51,7 +51,7 @@ final class PhabricatorConfigListController
->setHeader($group->getName())
->setHref('/config/group/'.$group->getKey().'/')
->addAttribute($group->getDescription())
->setIcon($group->getIcon());
->setImageIcon($group->getIcon());
$list->addItem($item);
}
}

View file

@ -31,7 +31,7 @@ final class DrydockConsoleController extends DrydockController {
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Blueprints'))
->setIcon('fa-map-o')
->setImageIcon('fa-map-o')
->setHref($this->getApplicationURI('blueprint/'))
->addAttribute(
pht(
@ -41,7 +41,7 @@ final class DrydockConsoleController extends DrydockController {
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Resources'))
->setIcon('fa-map')
->setImageIcon('fa-map')
->setHref($this->getApplicationURI('resource/'))
->addAttribute(
pht('View and manage resources Drydock has built, like hosts.')));
@ -49,14 +49,14 @@ final class DrydockConsoleController extends DrydockController {
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Leases'))
->setIcon('fa-link')
->setImageIcon('fa-link')
->setHref($this->getApplicationURI('lease/'))
->addAttribute(pht('Manage leases on resources.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Repository Operations'))
->setIcon('fa-fighter-jet')
->setImageIcon('fa-fighter-jet')
->setHref($this->getApplicationURI('operation/'))
->addAttribute(pht('Review the repository operation queue.')));

View file

@ -214,18 +214,6 @@ final class PhabricatorAppSearchEngine
$icon = 'application';
}
// TODO: This sheet doesn't work the same way other sheets do so it
// ends up with the wrong classes if we try to use PHUIIconView. This
// is probably all changing in the redesign anyway.
$icon_view = javelin_tag(
'span',
array(
'class' => 'phui-icon-view phui-font-fa '.$icon,
'aural' => false,
),
'');
$description = $application->getShortDescription();
$configure = id(new PHUIButtonView())
@ -241,7 +229,7 @@ final class PhabricatorAppSearchEngine
$item = id(new PHUIObjectItemView())
->setHeader($name)
->setImageIcon($icon_view)
->setImageIcon($icon)
->setSubhead($description)
->setLaunchButton($configure);

View file

@ -65,8 +65,8 @@ final class PhabricatorUserPreferencesSearchEngine
$item = id(new PHUIObjectItemView())
->setHeader($setting->getDisplayName())
->setHref($setting->getEditURI())
->setImageURI(PhabricatorUser::getDefaultProfileImageURI())
->setIcon('fa-globe')
// TODO: Replace this with NUX Style bg / white icon when built
->setImageIcon('fa-globe')
->addAttribute(pht('Edit global default settings for all users.'));
$list->addItem($item);

View file

@ -131,6 +131,10 @@ final class PHUIObjectItemView extends AphrontTagView {
}
public function setImageIcon($image_icon) {
if (!$image_icon instanceof PHUIIconView) {
$image_icon = id(new PHUIIconView())
->setIcon($image_icon);
}
$this->imageIcon = $image_icon;
return $this;
}
@ -167,11 +171,6 @@ final class PHUIObjectItemView extends AphrontTagView {
return $this;
}
public function setIcon($icon) {
// TODO: Remove this in favor of setStatusIcon()?
return $this->setStatusIcon($icon);
}
public function setStatusIcon($icon, $label = null) {
$this->statusIcon = array(
'icon' => $icon,