Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/audit/events/AuditPeopleMenuEventListener.php b/src/applications/audit/events/AuditPeopleMenuEventListener.php
index 9ba64d84c1..623ddc19a1 100644
--- a/src/applications/audit/events/AuditPeopleMenuEventListener.php
+++ b/src/applications/audit/events/AuditPeopleMenuEventListener.php
@@ -1,37 +1,38 @@
<?php
final class AuditPeopleMenuEventListener extends PhutilEventListener {
public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
}
public function handleEvent(PhutilEvent $event) {
switch ($event->getType()) {
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
$this->handleActionsEvent($event);
break;
}
}
private function handleActionsEvent($event) {
$person = $event->getValue('object');
if (!($person instanceof PhabricatorUser)) {
return;
}
$actions = $event->getValue('actions');
$username = phutil_escape_uri($person->getUsername());
$href = '/audit/view/author/'.$username.'/';
$actions[] = id(new PhabricatorActionView())
- ->setIcon('transcript')
+ ->setIcon('audit-dark')
+ ->setIconSheet(PHUIIconView::SPRITE_APPS)
->setName(pht('View Commits'))
->setHref($href);
$event->setValue('actions', $actions);
}
}
diff --git a/src/applications/differential/events/DifferentialPeopleMenuEventListener.php b/src/applications/differential/events/DifferentialPeopleMenuEventListener.php
index 7c1a88ee51..33551ce59f 100644
--- a/src/applications/differential/events/DifferentialPeopleMenuEventListener.php
+++ b/src/applications/differential/events/DifferentialPeopleMenuEventListener.php
@@ -1,38 +1,39 @@
<?php
final class DifferentialPeopleMenuEventListener extends PhutilEventListener {
public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
}
public function handleEvent(PhutilEvent $event) {
switch ($event->getType()) {
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
$this->handleActionsEvent($event);
break;
}
}
private function handleActionsEvent($event) {
$person = $event->getValue('object');
if (!($person instanceof PhabricatorUser)) {
return;
}
$href = '/differential/?authorPHIDs[]='.$person->getPHID();
$actions = $event->getValue('actions');
$actions[] = id(new PhabricatorActionView())
->setUser($event->getUser())
->setRenderAsForm(true)
- ->setIcon('transcript')
+ ->setIcon('differential-dark')
+ ->setIconSheet(PHUIIconView::SPRITE_APPS)
->setName(pht('View Revisions'))
->setHref($href);
$event->setValue('actions', $actions);
}
}
diff --git a/src/applications/maniphest/event/ManiphestPeopleMenuEventListener.php b/src/applications/maniphest/event/ManiphestPeopleMenuEventListener.php
index 76da62a57a..476fd8f513 100644
--- a/src/applications/maniphest/event/ManiphestPeopleMenuEventListener.php
+++ b/src/applications/maniphest/event/ManiphestPeopleMenuEventListener.php
@@ -1,35 +1,36 @@
<?php
final class ManiphestPeopleMenuEventListener extends PhutilEventListener {
public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
}
public function handleEvent(PhutilEvent $event) {
switch ($event->getType()) {
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
$this->handleActionsEvent($event);
break;
}
}
private function handleActionsEvent($event) {
$person = $event->getValue('object');
if (!($person instanceof PhabricatorUser)) {
return;
}
$href = '/maniphest/view/action/?users='.$person->getPHID();
$actions = $event->getValue('actions');
$actions[] = id(new PhabricatorActionView())
- ->setIcon('transcript')
+ ->setIcon('maniphest-dark')
+ ->setIconSheet(PHUIIconView::SPRITE_APPS)
->setName(pht('View Tasks'))
->setHref($href);
$event->setValue('actions', $actions);
}
}
diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php
index 0b1955ca28..697b595c6d 100644
--- a/src/view/layout/PhabricatorActionView.php
+++ b/src/view/layout/PhabricatorActionView.php
@@ -1,156 +1,159 @@
<?php
final class PhabricatorActionView extends AphrontView {
private $name;
private $icon;
+ private $iconSheet;
private $href;
private $disabled;
private $workflow;
private $renderAsForm;
private $download;
public function setDownload($download) {
$this->download = $download;
return $this;
}
public function getDownload() {
return $this->download;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function setIcon($icon) {
$this->icon = $icon;
return $this;
}
+ public function setIconSheet($sheet) {
+ $this->iconSheet = $sheet;
+ return $this;
+ }
+
public function setName($name) {
$this->name = $name;
return $this;
}
public function setDisabled($disabled) {
$this->disabled = $disabled;
return $this;
}
public function setWorkflow($workflow) {
$this->workflow = $workflow;
return $this;
}
public function setRenderAsForm($form) {
$this->renderAsForm = $form;
return $this;
}
public function render() {
$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) {
if ($this->renderAsForm) {
if (!$this->user) {
throw new Exception(
'Call setUser() when rendering an action as a form.');
}
$item = javelin_tag(
'button',
array(
'class' => 'phabricator-action-view-item',
),
$this->name);
$sigils = array();
if ($this->workflow) {
$sigils[] = 'workflow';
}
if ($this->download) {
$sigils[] = 'download';
}
$item = phabricator_form(
$this->user,
array(
'action' => $this->href,
'method' => 'POST',
'sigil' => implode(' ', $sigils),
),
$item);
} else {
$item = javelin_tag(
'a',
array(
'href' => $this->href,
'class' => 'phabricator-action-view-item',
'sigil' => $this->workflow ? 'workflow' : null,
),
$this->name);
}
} else {
$item = phutil_tag(
'span',
array(
'class' => 'phabricator-action-view-item',
),
$this->name);
}
$classes = array();
$classes[] = 'phabricator-action-view';
if ($this->disabled) {
$classes[] = 'phabricator-action-view-disabled';
}
return phutil_tag(
'li',
array(
'class' => implode(' ', $classes),
),
array($icon, $item));
}
public static function getAvailableIcons() {
$root = dirname(phutil_get_library_root('phabricator'));
$path = $root.'/resources/sprite/manifest/icons.json';
$data = Filesystem::readFile($path);
$manifest = json_decode($data, true);
$results = array();
$prefix = 'icons-';
foreach ($manifest['sprites'] as $sprite) {
$name = $sprite['name'];
if (preg_match('/-(white|grey)$/', $name)) {
continue;
}
if (!strncmp($name, $prefix, strlen($prefix))) {
$results[] = substr($name, strlen($prefix));
}
}
return $results;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 16:35 (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1126529
Default Alt Text
(8 KB)

Event Timeline