Skip to content

Commit e7aa874

Browse files
author
Chad Little
committed
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
1 parent 1ecce60 commit e7aa874

File tree

6 files changed

+17
-30
lines changed

6 files changed

+17
-30
lines changed

src/applications/almanac/controller/AlmanacConsoleController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function handleRequest(AphrontRequest $request) {
1616
id(new PHUIObjectItemView())
1717
->setHeader(pht('Devices'))
1818
->setHref($this->getApplicationURI('device/'))
19-
->setIcon('fa-server')
19+
->setImageIcon('fa-server')
2020
->addAttribute(
2121
pht(
2222
'Create an inventory of physical and virtual hosts and '.
@@ -26,7 +26,7 @@ public function handleRequest(AphrontRequest $request) {
2626
id(new PHUIObjectItemView())
2727
->setHeader(pht('Services'))
2828
->setHref($this->getApplicationURI('service/'))
29-
->setIcon('fa-plug')
29+
->setImageIcon('fa-plug')
3030
->addAttribute(
3131
pht(
3232
'Create and update services, and map them to interfaces on '.
@@ -36,7 +36,7 @@ public function handleRequest(AphrontRequest $request) {
3636
id(new PHUIObjectItemView())
3737
->setHeader(pht('Networks'))
3838
->setHref($this->getApplicationURI('network/'))
39-
->setIcon('fa-globe')
39+
->setImageIcon('fa-globe')
4040
->addAttribute(
4141
pht(
4242
'Manage public and private networks.')));
@@ -45,7 +45,7 @@ public function handleRequest(AphrontRequest $request) {
4545
id(new PHUIObjectItemView())
4646
->setHeader(pht('Namespaces'))
4747
->setHref($this->getApplicationURI('namespace/'))
48-
->setIcon('fa-asterisk')
48+
->setImageIcon('fa-asterisk')
4949
->addAttribute(
5050
pht('Control who can create new named services and devices.')));
5151

@@ -56,7 +56,7 @@ public function handleRequest(AphrontRequest $request) {
5656
id(new PHUIObjectItemView())
5757
->setHeader(pht('Documentation'))
5858
->setHref($docs_uri)
59-
->setIcon('fa-book')
59+
->setImageIcon('fa-book')
6060
->addAttribute(pht('Browse documentation for Almanac.')));
6161

6262
$crumbs = $this->buildApplicationCrumbs();

src/applications/config/controller/PhabricatorConfigListController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private function buildConfigOptionsList(array $groups, $type) {
5151
->setHeader($group->getName())
5252
->setHref('/config/group/'.$group->getKey().'/')
5353
->addAttribute($group->getDescription())
54-
->setIcon($group->getIcon());
54+
->setImageIcon($group->getIcon());
5555
$list->addItem($item);
5656
}
5757
}

src/applications/drydock/controller/DrydockConsoleController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function handleRequest(AphrontRequest $request) {
3131
$menu->addItem(
3232
id(new PHUIObjectItemView())
3333
->setHeader(pht('Blueprints'))
34-
->setIcon('fa-map-o')
34+
->setImageIcon('fa-map-o')
3535
->setHref($this->getApplicationURI('blueprint/'))
3636
->addAttribute(
3737
pht(
@@ -41,22 +41,22 @@ public function handleRequest(AphrontRequest $request) {
4141
$menu->addItem(
4242
id(new PHUIObjectItemView())
4343
->setHeader(pht('Resources'))
44-
->setIcon('fa-map')
44+
->setImageIcon('fa-map')
4545
->setHref($this->getApplicationURI('resource/'))
4646
->addAttribute(
4747
pht('View and manage resources Drydock has built, like hosts.')));
4848

4949
$menu->addItem(
5050
id(new PHUIObjectItemView())
5151
->setHeader(pht('Leases'))
52-
->setIcon('fa-link')
52+
->setImageIcon('fa-link')
5353
->setHref($this->getApplicationURI('lease/'))
5454
->addAttribute(pht('Manage leases on resources.')));
5555

5656
$menu->addItem(
5757
id(new PHUIObjectItemView())
5858
->setHeader(pht('Repository Operations'))
59-
->setIcon('fa-fighter-jet')
59+
->setImageIcon('fa-fighter-jet')
6060
->setHref($this->getApplicationURI('operation/'))
6161
->addAttribute(pht('Review the repository operation queue.')));
6262

src/applications/meta/query/PhabricatorAppSearchEngine.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,6 @@ protected function renderResultList(
214214
$icon = 'application';
215215
}
216216

217-
// TODO: This sheet doesn't work the same way other sheets do so it
218-
// ends up with the wrong classes if we try to use PHUIIconView. This
219-
// is probably all changing in the redesign anyway.
220-
221-
$icon_view = javelin_tag(
222-
'span',
223-
array(
224-
'class' => 'phui-icon-view phui-font-fa '.$icon,
225-
'aural' => false,
226-
),
227-
'');
228-
229217
$description = $application->getShortDescription();
230218

231219
$configure = id(new PHUIButtonView())
@@ -241,7 +229,7 @@ protected function renderResultList(
241229

242230
$item = id(new PHUIObjectItemView())
243231
->setHeader($name)
244-
->setImageIcon($icon_view)
232+
->setImageIcon($icon)
245233
->setSubhead($description)
246234
->setLaunchButton($configure);
247235

src/applications/settings/query/PhabricatorUserPreferencesSearchEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ protected function renderResultList(
6565
$item = id(new PHUIObjectItemView())
6666
->setHeader($setting->getDisplayName())
6767
->setHref($setting->getEditURI())
68-
->setImageURI(PhabricatorUser::getDefaultProfileImageURI())
69-
->setIcon('fa-globe')
68+
// TODO: Replace this with NUX Style bg / white icon when built
69+
->setImageIcon('fa-globe')
7070
->addAttribute(pht('Edit global default settings for all users.'));
7171

7272
$list->addItem($item);

src/view/phui/PHUIObjectItemView.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ public function getImageURI() {
131131
}
132132

133133
public function setImageIcon($image_icon) {
134+
if (!$image_icon instanceof PHUIIconView) {
135+
$image_icon = id(new PHUIIconView())
136+
->setIcon($image_icon);
137+
}
134138
$this->imageIcon = $image_icon;
135139
return $this;
136140
}
@@ -167,11 +171,6 @@ public function addIcon($icon, $label = null, $attributes = array()) {
167171
return $this;
168172
}
169173

170-
public function setIcon($icon) {
171-
// TODO: Remove this in favor of setStatusIcon()?
172-
return $this->setStatusIcon($icon);
173-
}
174-
175174
public function setStatusIcon($icon, $label = null) {
176175
$this->statusIcon = array(
177176
'icon' => $icon,

0 commit comments

Comments
 (0)