2013-04-05 16:40:27 +02:00
|
|
|
<?php
|
|
|
|
|
2013-04-22 18:49:06 +02:00
|
|
|
final class PHUIIconView extends AphrontTagView {
|
2013-04-05 16:40:27 +02:00
|
|
|
|
|
|
|
const SPRITE_MINICONS = 'minicons';
|
|
|
|
const SPRITE_ACTIONS = 'actions';
|
2013-04-13 18:09:42 +02:00
|
|
|
const SPRITE_APPS = 'apps';
|
2013-04-20 02:44:20 +02:00
|
|
|
const SPRITE_TOKENS = 'tokens';
|
2013-04-23 01:41:00 +02:00
|
|
|
const SPRITE_PAYMENTS = 'payments';
|
Add action icons to object list views
Summary:
We have a few interfaces where add "Edit", "Delete" or some other action to a list. Currently, this happens via icons, but these are cumbersome and weird, are inconsistent, can't be workflow'd, are hard to hit on desktops and virtually impossible to hit on mobile, and generally just feel iffy to me. Prominent examples are Projects and Flags. I'd like to try adding an "edit" action to Maniphest (to provide quick edit from list views, basically). It looks like some of Releeph would benefit here, as well.
Instead, provide first-class actions:
{F42978}
They produce targets which my meaty ham-fists can plausibly hit on mobile, too:
{F42979}
(We could do some kind of swipe-to-expose thing eventually, but I think putting them by default is OK?)
Test Plan: Added UIExamples. Checked desktop/mobile.
Reviewers: chad, btrahan, edward
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D5890
2013-05-10 21:57:01 +02:00
|
|
|
const SPRITE_ICONS = 'icons';
|
2013-06-13 00:05:16 +02:00
|
|
|
const SPRITE_LOGIN = 'login';
|
2013-07-24 23:13:22 +02:00
|
|
|
const SPRITE_STATUS = 'status';
|
2013-10-17 18:32:34 +02:00
|
|
|
const SPRITE_PROJECTS = 'projects';
|
2013-04-20 02:44:20 +02:00
|
|
|
|
|
|
|
const HEAD_SMALL = 'phuihead-small';
|
|
|
|
const HEAD_MEDIUM = 'phuihead-medium';
|
2013-04-05 16:40:27 +02:00
|
|
|
|
2013-04-22 18:49:06 +02:00
|
|
|
private $href = null;
|
2013-04-05 16:40:27 +02:00
|
|
|
private $image;
|
2013-04-20 02:44:20 +02:00
|
|
|
private $headSize = null;
|
2013-04-05 16:40:27 +02:00
|
|
|
private $spriteIcon;
|
|
|
|
private $spriteSheet;
|
|
|
|
|
|
|
|
public function setHref($href) {
|
|
|
|
$this->href = $href;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setImage($image) {
|
|
|
|
$this->image = $image;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-04-20 02:44:20 +02:00
|
|
|
public function setHeadSize($size) {
|
|
|
|
$this->headSize = $size;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-04-05 16:40:27 +02:00
|
|
|
public function setSpriteIcon($sprite) {
|
|
|
|
$this->spriteIcon = $sprite;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setSpriteSheet($sheet) {
|
|
|
|
$this->spriteSheet = $sheet;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-04-22 18:49:06 +02:00
|
|
|
public function getTagName() {
|
2013-04-13 18:09:42 +02:00
|
|
|
$tag = 'span';
|
|
|
|
if ($this->href) {
|
|
|
|
$tag = 'a';
|
|
|
|
}
|
2013-04-22 18:49:06 +02:00
|
|
|
return $tag;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTagAttributes() {
|
|
|
|
require_celerity_resource('phui-icon-view-css');
|
2013-04-13 18:09:42 +02:00
|
|
|
|
Add action icons to object list views
Summary:
We have a few interfaces where add "Edit", "Delete" or some other action to a list. Currently, this happens via icons, but these are cumbersome and weird, are inconsistent, can't be workflow'd, are hard to hit on desktops and virtually impossible to hit on mobile, and generally just feel iffy to me. Prominent examples are Projects and Flags. I'd like to try adding an "edit" action to Maniphest (to provide quick edit from list views, basically). It looks like some of Releeph would benefit here, as well.
Instead, provide first-class actions:
{F42978}
They produce targets which my meaty ham-fists can plausibly hit on mobile, too:
{F42979}
(We could do some kind of swipe-to-expose thing eventually, but I think putting them by default is OK?)
Test Plan: Added UIExamples. Checked desktop/mobile.
Reviewers: chad, btrahan, edward
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D5890
2013-05-10 21:57:01 +02:00
|
|
|
$style = null;
|
|
|
|
$classes = array();
|
|
|
|
$classes[] = 'phui-icon-view';
|
2013-04-20 02:44:20 +02:00
|
|
|
|
2013-04-05 16:40:27 +02:00
|
|
|
if ($this->spriteIcon) {
|
2013-04-13 18:09:42 +02:00
|
|
|
require_celerity_resource('sprite-'.$this->spriteSheet.'-css');
|
Add action icons to object list views
Summary:
We have a few interfaces where add "Edit", "Delete" or some other action to a list. Currently, this happens via icons, but these are cumbersome and weird, are inconsistent, can't be workflow'd, are hard to hit on desktops and virtually impossible to hit on mobile, and generally just feel iffy to me. Prominent examples are Projects and Flags. I'd like to try adding an "edit" action to Maniphest (to provide quick edit from list views, basically). It looks like some of Releeph would benefit here, as well.
Instead, provide first-class actions:
{F42978}
They produce targets which my meaty ham-fists can plausibly hit on mobile, too:
{F42979}
(We could do some kind of swipe-to-expose thing eventually, but I think putting them by default is OK?)
Test Plan: Added UIExamples. Checked desktop/mobile.
Reviewers: chad, btrahan, edward
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D5890
2013-05-10 21:57:01 +02:00
|
|
|
$classes[] = 'sprite-'.$this->spriteSheet;
|
|
|
|
$classes[] = $this->spriteSheet.'-'.$this->spriteIcon;
|
2013-04-05 16:40:27 +02:00
|
|
|
} else {
|
2013-04-20 02:44:20 +02:00
|
|
|
if ($this->headSize) {
|
Add action icons to object list views
Summary:
We have a few interfaces where add "Edit", "Delete" or some other action to a list. Currently, this happens via icons, but these are cumbersome and weird, are inconsistent, can't be workflow'd, are hard to hit on desktops and virtually impossible to hit on mobile, and generally just feel iffy to me. Prominent examples are Projects and Flags. I'd like to try adding an "edit" action to Maniphest (to provide quick edit from list views, basically). It looks like some of Releeph would benefit here, as well.
Instead, provide first-class actions:
{F42978}
They produce targets which my meaty ham-fists can plausibly hit on mobile, too:
{F42979}
(We could do some kind of swipe-to-expose thing eventually, but I think putting them by default is OK?)
Test Plan: Added UIExamples. Checked desktop/mobile.
Reviewers: chad, btrahan, edward
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D5890
2013-05-10 21:57:01 +02:00
|
|
|
$classes[] = $this->headSize;
|
2013-04-20 02:44:20 +02:00
|
|
|
}
|
Add action icons to object list views
Summary:
We have a few interfaces where add "Edit", "Delete" or some other action to a list. Currently, this happens via icons, but these are cumbersome and weird, are inconsistent, can't be workflow'd, are hard to hit on desktops and virtually impossible to hit on mobile, and generally just feel iffy to me. Prominent examples are Projects and Flags. I'd like to try adding an "edit" action to Maniphest (to provide quick edit from list views, basically). It looks like some of Releeph would benefit here, as well.
Instead, provide first-class actions:
{F42978}
They produce targets which my meaty ham-fists can plausibly hit on mobile, too:
{F42979}
(We could do some kind of swipe-to-expose thing eventually, but I think putting them by default is OK?)
Test Plan: Added UIExamples. Checked desktop/mobile.
Reviewers: chad, btrahan, edward
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D5890
2013-05-10 21:57:01 +02:00
|
|
|
$style = 'background-image: url('.$this->image.');';
|
2013-04-05 16:40:27 +02:00
|
|
|
}
|
|
|
|
|
Add action icons to object list views
Summary:
We have a few interfaces where add "Edit", "Delete" or some other action to a list. Currently, this happens via icons, but these are cumbersome and weird, are inconsistent, can't be workflow'd, are hard to hit on desktops and virtually impossible to hit on mobile, and generally just feel iffy to me. Prominent examples are Projects and Flags. I'd like to try adding an "edit" action to Maniphest (to provide quick edit from list views, basically). It looks like some of Releeph would benefit here, as well.
Instead, provide first-class actions:
{F42978}
They produce targets which my meaty ham-fists can plausibly hit on mobile, too:
{F42979}
(We could do some kind of swipe-to-expose thing eventually, but I think putting them by default is OK?)
Test Plan: Added UIExamples. Checked desktop/mobile.
Reviewers: chad, btrahan, edward
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D5890
2013-05-10 21:57:01 +02:00
|
|
|
return array(
|
|
|
|
'href' => $this->href,
|
|
|
|
'style' => $style,
|
|
|
|
'class' => $classes,
|
|
|
|
);
|
2013-04-05 16:40:27 +02:00
|
|
|
}
|
2013-07-24 23:13:22 +02:00
|
|
|
|
|
|
|
public static function getSheetManifest($sheet) {
|
|
|
|
$root = dirname(phutil_get_library_root('phabricator'));
|
|
|
|
$path = $root.'/resources/sprite/manifest/'.$sheet.'.json';
|
|
|
|
$data = Filesystem::readFile($path);
|
|
|
|
return idx(json_decode($data, true), 'sprites');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-05 16:40:27 +02:00
|
|
|
}
|