1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 08:20:57 +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()) id(new PHUIObjectItemView())
->setHeader(pht('Devices')) ->setHeader(pht('Devices'))
->setHref($this->getApplicationURI('device/')) ->setHref($this->getApplicationURI('device/'))
->setIcon('fa-server') ->setImageIcon('fa-server')
->addAttribute( ->addAttribute(
pht( pht(
'Create an inventory of physical and virtual hosts and '. 'Create an inventory of physical and virtual hosts and '.
@ -26,7 +26,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView()) id(new PHUIObjectItemView())
->setHeader(pht('Services')) ->setHeader(pht('Services'))
->setHref($this->getApplicationURI('service/')) ->setHref($this->getApplicationURI('service/'))
->setIcon('fa-plug') ->setImageIcon('fa-plug')
->addAttribute( ->addAttribute(
pht( pht(
'Create and update services, and map them to interfaces on '. 'Create and update services, and map them to interfaces on '.
@ -36,7 +36,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView()) id(new PHUIObjectItemView())
->setHeader(pht('Networks')) ->setHeader(pht('Networks'))
->setHref($this->getApplicationURI('network/')) ->setHref($this->getApplicationURI('network/'))
->setIcon('fa-globe') ->setImageIcon('fa-globe')
->addAttribute( ->addAttribute(
pht( pht(
'Manage public and private networks.'))); 'Manage public and private networks.')));
@ -45,7 +45,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView()) id(new PHUIObjectItemView())
->setHeader(pht('Namespaces')) ->setHeader(pht('Namespaces'))
->setHref($this->getApplicationURI('namespace/')) ->setHref($this->getApplicationURI('namespace/'))
->setIcon('fa-asterisk') ->setImageIcon('fa-asterisk')
->addAttribute( ->addAttribute(
pht('Control who can create new named services and devices.'))); pht('Control who can create new named services and devices.')));
@ -56,7 +56,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView()) id(new PHUIObjectItemView())
->setHeader(pht('Documentation')) ->setHeader(pht('Documentation'))
->setHref($docs_uri) ->setHref($docs_uri)
->setIcon('fa-book') ->setImageIcon('fa-book')
->addAttribute(pht('Browse documentation for Almanac.'))); ->addAttribute(pht('Browse documentation for Almanac.')));
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();

View file

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

View file

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

View file

@ -214,18 +214,6 @@ final class PhabricatorAppSearchEngine
$icon = 'application'; $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(); $description = $application->getShortDescription();
$configure = id(new PHUIButtonView()) $configure = id(new PHUIButtonView())
@ -241,7 +229,7 @@ final class PhabricatorAppSearchEngine
$item = id(new PHUIObjectItemView()) $item = id(new PHUIObjectItemView())
->setHeader($name) ->setHeader($name)
->setImageIcon($icon_view) ->setImageIcon($icon)
->setSubhead($description) ->setSubhead($description)
->setLaunchButton($configure); ->setLaunchButton($configure);

View file

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

View file

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