mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 03:12:41 +01:00
f26be0e2d4
Summary: See discussion in D6131, D6130. This turned into 35 layers of mess so throw it away and just tweak the JS to be more flexible. Test Plan: - Clicked "Show More Applications". - Clicked "Show Fewer Applications". - Edited tasks using popup dialog. - Tried to drag tasks using pencil icon (correctly no longer works). - Changed threads in Conpherence. - Not sure how to actually hit the Conpherence "Load ... Threads" thing since it seems to auto-load? But that works, at least, and the code doesn't really care what you hit. - Added a conpherence participant. - Added a new calendar item. - Poked around other menus. Reviewers: chad Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D6133
148 lines
2.8 KiB
PHP
148 lines
2.8 KiB
PHP
<?php
|
|
|
|
final class PHUIListItemView extends AphrontTagView {
|
|
|
|
const TYPE_LINK = 'type-link';
|
|
const TYPE_SPACER = 'type-spacer';
|
|
const TYPE_LABEL = 'type-label';
|
|
const TYPE_BUTTON = 'type-button';
|
|
const TYPE_CUSTOM = 'type-custom';
|
|
const TYPE_DIVIDER = 'type-divider';
|
|
const TYPE_ICON = 'type-icon';
|
|
|
|
private $name;
|
|
private $href;
|
|
private $type = self::TYPE_LINK;
|
|
private $isExternal;
|
|
private $key;
|
|
private $icon;
|
|
private $selected;
|
|
private $containerAttrs;
|
|
|
|
public function setSelected($selected) {
|
|
$this->selected = $selected;
|
|
return $this;
|
|
}
|
|
|
|
public function getSelected() {
|
|
return $this->selected;
|
|
}
|
|
|
|
public function setIcon($icon) {
|
|
$this->icon = $icon;
|
|
return $this;
|
|
}
|
|
|
|
public function getIcon() {
|
|
return $this->icon;
|
|
}
|
|
|
|
public function setKey($key) {
|
|
$this->key = (string)$key;
|
|
return $this;
|
|
}
|
|
|
|
public function getKey() {
|
|
return $this->key;
|
|
}
|
|
|
|
public function setType($type) {
|
|
$this->type = $type;
|
|
return $this;
|
|
}
|
|
|
|
public function getType() {
|
|
return $this->type;
|
|
}
|
|
|
|
public function setHref($href) {
|
|
$this->href = $href;
|
|
return $this;
|
|
}
|
|
|
|
public function getHref() {
|
|
return $this->href;
|
|
}
|
|
|
|
public function setName($name) {
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
public function getName() {
|
|
return $this->name;
|
|
}
|
|
|
|
public function setIsExternal($is_external) {
|
|
$this->isExternal = $is_external;
|
|
return $this;
|
|
}
|
|
|
|
public function getIsExternal() {
|
|
return $this->isExternal;
|
|
}
|
|
|
|
protected function getTagName() {
|
|
return 'li';
|
|
}
|
|
|
|
protected function getTagAttributes() {
|
|
$classes = array();
|
|
$classes[] = 'phui-list-item-view';
|
|
$classes[] = 'phui-list-item-'.$this->type;
|
|
|
|
if ($this->icon) {
|
|
$classes[] = 'phui-list-item-has-icon';
|
|
}
|
|
|
|
if ($this->selected) {
|
|
$classes[] = 'phui-list-item-selected';
|
|
}
|
|
|
|
return array(
|
|
'class' => $classes,
|
|
);
|
|
}
|
|
|
|
protected function getTagContent() {
|
|
$name = null;
|
|
$icon = null;
|
|
|
|
if ($this->name) {
|
|
$external = null;
|
|
if ($this->isExternal) {
|
|
$external = " \xE2\x86\x97";
|
|
}
|
|
|
|
$name = phutil_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'phui-list-item-name',
|
|
),
|
|
array(
|
|
$this->name,
|
|
$external,
|
|
));
|
|
}
|
|
|
|
if ($this->icon) {
|
|
$icon = id(new PHUIIconView())
|
|
->addClass('phui-list-item-icon')
|
|
->setSpriteSheet(PHUIIconView::SPRITE_ICONS)
|
|
->setSpriteIcon($this->icon);
|
|
}
|
|
|
|
return phutil_tag(
|
|
$this->href ? 'a' : 'div',
|
|
array(
|
|
'href' => $this->href,
|
|
'class' => $this->href ? 'phui-list-item-href' : null,
|
|
),
|
|
array(
|
|
$icon,
|
|
$this->renderChildren(),
|
|
$name,
|
|
));
|
|
}
|
|
|
|
}
|