1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Use PHUIIconView for PhabricatorActionView

Summary: Allows application icons to appear in action lists.

Test Plan: {F49487}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6408
This commit is contained in:
epriestley 2013-07-10 12:33:51 -07:00
parent 4fb3b27f1d
commit a77ab312f0
4 changed files with 17 additions and 11 deletions

View file

@ -26,7 +26,8 @@ final class AuditPeopleMenuEventListener extends PhutilEventListener {
$href = '/audit/view/author/'.$username.'/';
$actions[] = id(new PhabricatorActionView())
->setIcon('transcript')
->setIcon('audit-dark')
->setIconSheet(PHUIIconView::SPRITE_APPS)
->setName(pht('View Commits'))
->setHref($href);

View file

@ -27,7 +27,8 @@ final class DifferentialPeopleMenuEventListener extends PhutilEventListener {
$actions[] = id(new PhabricatorActionView())
->setUser($event->getUser())
->setRenderAsForm(true)
->setIcon('transcript')
->setIcon('differential-dark')
->setIconSheet(PHUIIconView::SPRITE_APPS)
->setName(pht('View Revisions'))
->setHref($href);

View file

@ -25,7 +25,8 @@ final class ManiphestPeopleMenuEventListener extends PhutilEventListener {
$actions = $event->getValue('actions');
$actions[] = id(new PhabricatorActionView())
->setIcon('transcript')
->setIcon('maniphest-dark')
->setIconSheet(PHUIIconView::SPRITE_APPS)
->setName(pht('View Tasks'))
->setHref($href);

View file

@ -4,6 +4,7 @@ final class PhabricatorActionView extends AphrontView {
private $name;
private $icon;
private $iconSheet;
private $href;
private $disabled;
private $workflow;
@ -29,6 +30,11 @@ final class PhabricatorActionView extends AphrontView {
return $this;
}
public function setIconSheet($sheet) {
$this->iconSheet = $sheet;
return $this;
}
public function setName($name) {
$this->name = $name;
return $this;
@ -53,20 +59,17 @@ final class PhabricatorActionView extends AphrontView {
$icon = null;
if ($this->icon) {
$sheet = nonempty($this->iconSheet, PHUIIconView::SPRITE_ICONS);
$suffix = '';
if ($this->disabled) {
$suffix = '-grey';
}
require_celerity_resource('sprite-icons-css');
$icon = phutil_tag(
'span',
array(
'class' => 'phabricator-action-view-icon sprite-icons '.
'icons-'.$this->icon.$suffix,
),
'');
$icon = id(new PHUIIconView())
->addClass('phabricator-action-view-icon')
->setSpriteIcon($this->icon.$suffix)
->setSpriteSheet($sheet);
}
if ($this->href) {