mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 13:52:40 +01:00
For actions in list views, render name as tooltip if available
Summary: While the icons are sometimes pretty obvious ("X" for delete, "pencil" for edit), some are more obscure ("Disable", "Ignore"), especially if you haven't seen the interface before. If a name is available, render it as a tooltip. Test Plan: {F49905} Reviewers: chad, btrahan Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D6434
This commit is contained in:
parent
147302dfa6
commit
a9690a81c6
2 changed files with 39 additions and 14 deletions
|
@ -427,7 +427,10 @@ final class PhabricatorObjectItemView extends AphrontTagView {
|
|||
|
||||
$actions = array();
|
||||
if ($this->actions) {
|
||||
Javelin::initBehavior('phabricator-tooltips');
|
||||
|
||||
foreach (array_reverse($this->actions) as $action) {
|
||||
$action->setRenderNameAsTooltip(true);
|
||||
$actions[] = $action;
|
||||
}
|
||||
$actions = phutil_tag(
|
||||
|
|
|
@ -19,6 +19,17 @@ final class PHUIListItemView extends AphrontTagView {
|
|||
private $selected;
|
||||
private $containerAttrs;
|
||||
private $disabled;
|
||||
private $renderNameAsTooltip;
|
||||
|
||||
|
||||
public function setRenderNameAsTooltip($render_name_as_tooltip) {
|
||||
$this->renderNameAsTooltip = $render_name_as_tooltip;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRenderNameAsTooltip() {
|
||||
return $this->renderNameAsTooltip;
|
||||
}
|
||||
|
||||
public function setSelected($selected) {
|
||||
$this->selected = $selected;
|
||||
|
@ -117,22 +128,31 @@ final class PHUIListItemView extends AphrontTagView {
|
|||
protected function getTagContent() {
|
||||
$name = null;
|
||||
$icon = null;
|
||||
$meta = null;
|
||||
$sigil = null;
|
||||
|
||||
if ($this->name) {
|
||||
$external = null;
|
||||
if ($this->isExternal) {
|
||||
$external = " \xE2\x86\x97";
|
||||
}
|
||||
if ($this->getRenderNameAsTooltip()) {
|
||||
$sigil = 'has-tooltip';
|
||||
$meta = array(
|
||||
'tip' => $this->name,
|
||||
);
|
||||
} else {
|
||||
$external = null;
|
||||
if ($this->isExternal) {
|
||||
$external = " \xE2\x86\x97";
|
||||
}
|
||||
|
||||
$name = phutil_tag(
|
||||
'span',
|
||||
array(
|
||||
'class' => 'phui-list-item-name',
|
||||
),
|
||||
array(
|
||||
$this->name,
|
||||
$external,
|
||||
));
|
||||
$name = phutil_tag(
|
||||
'span',
|
||||
array(
|
||||
'class' => 'phui-list-item-name',
|
||||
),
|
||||
array(
|
||||
$this->name,
|
||||
$external,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->icon) {
|
||||
|
@ -147,11 +167,13 @@ final class PHUIListItemView extends AphrontTagView {
|
|||
->setSpriteIcon($icon_name);
|
||||
}
|
||||
|
||||
return phutil_tag(
|
||||
return javelin_tag(
|
||||
$this->href ? 'a' : 'div',
|
||||
array(
|
||||
'href' => $this->href,
|
||||
'class' => $this->href ? 'phui-list-item-href' : null,
|
||||
'meta' => $meta,
|
||||
'sigil' => $sigil,
|
||||
),
|
||||
array(
|
||||
$icon,
|
||||
|
|
Loading…
Reference in a new issue