Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIListItemView.php
Show All 29 Lines | final class PHUIListItemView extends AphrontTagView { | ||||
private $hideInApplicationMenu; | private $hideInApplicationMenu; | ||||
private $icons = array(); | private $icons = array(); | ||||
private $openInNewWindow = false; | private $openInNewWindow = false; | ||||
private $tooltip; | private $tooltip; | ||||
private $actionIcon; | private $actionIcon; | ||||
private $actionIconHref; | private $actionIconHref; | ||||
private $count; | private $count; | ||||
private $rel; | private $rel; | ||||
private $hasDropdown; | |||||
public function setOpenInNewWindow($open_in_new_window) { | public function setOpenInNewWindow($open_in_new_window) { | ||||
$this->openInNewWindow = $open_in_new_window; | $this->openInNewWindow = $open_in_new_window; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getOpenInNewWindow() { | public function getOpenInNewWindow() { | ||||
return $this->openInNewWindow; | return $this->openInNewWindow; | ||||
Show All 17 Lines | public function getHideInApplicationMenu() { | ||||
return $this->hideInApplicationMenu; | return $this->hideInApplicationMenu; | ||||
} | } | ||||
public function setDropdownMenu(PhabricatorActionListView $actions) { | public function setDropdownMenu(PhabricatorActionListView $actions) { | ||||
Javelin::initBehavior('phui-dropdown-menu'); | Javelin::initBehavior('phui-dropdown-menu'); | ||||
$this->addSigil('phui-dropdown-menu'); | $this->addSigil('phui-dropdown-menu'); | ||||
$this->setMetadata($actions->getDropdownMenuMetadata()); | $this->setMetadata($actions->getDropdownMenuMetadata()); | ||||
$this->hasDropdown = true; | |||||
return $this; | return $this; | ||||
} | } | ||||
public function setAural($aural) { | public function setAural($aural) { | ||||
$this->aural = $aural; | $this->aural = $aural; | ||||
return $this; | return $this; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | protected function getTagAttributes() { | ||||
if ($this->statusColor) { | if ($this->statusColor) { | ||||
$classes[] = $this->statusColor; | $classes[] = $this->statusColor; | ||||
} | } | ||||
if ($this->actionIcon) { | if ($this->actionIcon) { | ||||
$classes[] = 'phui-list-item-has-action-icon'; | $classes[] = 'phui-list-item-has-action-icon'; | ||||
} | } | ||||
if ($this->hasDropdown) { | |||||
$classes[] = 'dropdown'; | |||||
} | |||||
return array( | return array( | ||||
'class' => implode(' ', $classes), | 'class' => implode(' ', $classes), | ||||
); | ); | ||||
} | } | ||||
public function setDisabled($disabled) { | public function setDisabled($disabled) { | ||||
$this->disabled = $disabled; | $this->disabled = $disabled; | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | if ($this->count) { | ||||
$count = phutil_tag( | $count = phutil_tag( | ||||
'span', | 'span', | ||||
array( | array( | ||||
'class' => 'phui-list-item-count', | 'class' => 'phui-list-item-count', | ||||
), | ), | ||||
$this->count); | $this->count); | ||||
} | } | ||||
if ($this->hasDropdown) { | |||||
$caret = phutil_tag('span', array('class' => 'caret'), ''); | |||||
} else { | |||||
$caret = null; | |||||
} | |||||
$icons = $this->getIcons(); | $icons = $this->getIcons(); | ||||
$list_item = javelin_tag( | $list_item = javelin_tag( | ||||
$this->href ? 'a' : 'div', | $this->href ? 'a' : 'div', | ||||
array( | array( | ||||
'href' => $this->href, | 'href' => $this->href, | ||||
'class' => implode(' ', $classes), | 'class' => implode(' ', $classes), | ||||
'meta' => $meta, | 'meta' => $meta, | ||||
'sigil' => $sigil, | 'sigil' => $sigil, | ||||
'target' => $this->getOpenInNewWindow() ? '_blank' : null, | 'target' => $this->getOpenInNewWindow() ? '_blank' : null, | ||||
'rel' => $this->rel, | 'rel' => $this->rel, | ||||
), | ), | ||||
array( | array( | ||||
$aural, | $aural, | ||||
$icon, | $icon, | ||||
$icons, | $icons, | ||||
$this->renderChildren(), | $this->renderChildren(), | ||||
$name, | $name, | ||||
$caret, | |||||
$count, | $count, | ||||
)); | )); | ||||
return array($list_item, $action_link); | return array($list_item, $action_link); | ||||
} | } | ||||
} | } |