Add FontIcons to PHUIObjectItemView

Summary: Added generic FontIcons for PHUIObjectItemView, used in Almanac Console. Simplified States.

Test Plan:
Almanac Console, UIExamples

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11527
This commit is contained in:
Chad Little
2015-01-27 12:25:54 -08:00
parent af16226804
commit 155b83bb6e
4 changed files with 32 additions and 40 deletions

View File

@@ -10,12 +10,14 @@ final class AlmanacConsoleController extends AlmanacController {
$viewer = $request->getViewer();
$menu = id(new PHUIObjectItemListView())
->setUser($viewer);
->setUser($viewer)
->setStackable(true);
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Services'))
->setHref($this->getApplicationURI('service/'))
->setFontIcon('fa-plug')
->addAttribute(
pht(
'Manage Almanac services.')));
@@ -24,6 +26,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView())
->setHeader(pht('Devices'))
->setHref($this->getApplicationURI('device/'))
->setFontIcon('fa-server')
->addAttribute(
pht(
'Manage Almanac devices.')));
@@ -32,6 +35,7 @@ final class AlmanacConsoleController extends AlmanacController {
id(new PHUIObjectItemView())
->setHeader(pht('Networks'))
->setHref($this->getApplicationURI('network/'))
->setFontIcon('fa-globe')
->addAttribute(
pht(
'Manage Almanac networks.')));
@@ -39,10 +43,14 @@ final class AlmanacConsoleController extends AlmanacController {
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Console'));
$box = id(new PHUIObjectBoxView())
->setHeaderText('Console')
->appendChild($menu);
return $this->buildApplicationPage(
array(
$crumbs,
$menu,
$box,
),
array(
'title' => pht('Almanac Console'),

View File

@@ -144,8 +144,13 @@ final class PHUIObjectItemView extends AphrontTagView {
$fi = 'fa-refresh ph-spin sky';
break;
}
$this->setFontIcon($fi);
return $this;
}
public function setFontIcon($icon) {
$this->fontIcon = id(new PHUIIconView())
->setIconFont($fi.' fa-2x');
->setIconFont($icon);
return $this;
}
@@ -537,15 +542,6 @@ final class PHUIObjectItemView extends AphrontTagView {
$this->getImageIcon());
}
if ($image && $this->href) {
$image = phutil_tag(
'a',
array(
'href' => $this->href,
),
$image);
}
$ficon = null;
if ($this->fontIcon) {
$image = phutil_tag(
@@ -556,6 +552,15 @@ final class PHUIObjectItemView extends AphrontTagView {
$this->fontIcon);
}
if ($image && $this->href) {
$image = phutil_tag(
'a',
array(
'href' => $this->href,
),
$image);
}
/* Build a fake table */
$column1 = phutil_tag(
'div',