Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIListItemView.php
| Show First 20 Lines • Show All 239 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'; | ||||
| } | } | ||||
| $sigil = null; | |||||
| $metadata = null; | |||||
| if ($this->dropdownMenu) { | if ($this->dropdownMenu) { | ||||
| $classes[] = 'dropdown'; | $classes[] = 'dropdown'; | ||||
| if (!$this->actionIcon) { | if (!$this->actionIcon) { | ||||
| throw new Exception( | $classes[] = 'dropdown-with-caret'; | ||||
| pht( | Javelin::initBehavior('phui-dropdown-menu'); | ||||
| 'List item views can not currently render a dropdown without '. | $sigil = 'phui-dropdown-menu'; | ||||
| 'an action icon, because no application uses one. Clean up '. | $metadata = $this->dropdownMenu->getDropdownMenuMetadata(); | ||||
| 'PHUICrumbsView, then add this capability.')); | |||||
| } | } | ||||
| } | } | ||||
| return array( | return array( | ||||
| 'class' => $classes, | 'class' => $classes, | ||||
| 'sigil' => $sigil, | |||||
| 'meta' => $metadata, | |||||
| ); | ); | ||||
| } | } | ||||
| public function setDisabled($disabled) { | public function setDisabled($disabled) { | ||||
| $this->disabled = $disabled; | $this->disabled = $disabled; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 98 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); | ||||
| } | } | ||||
| $caret = null; | |||||
| if ($this->dropdownMenu && !$this->actionIcon) { | |||||
| $caret = id(new PHUIIconView()) | |||||
| ->setIcon('fa-caret-down'); | |||||
| } | |||||
| $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, | ||||
| $count, | $count, | ||||
| $caret, | |||||
| )); | )); | ||||
| return array($list_item, $action_link); | return array($list_item, $action_link); | ||||
| } | } | ||||
| private function newActionIconView() { | private function newActionIconView() { | ||||
| $action_icon = $this->actionIcon; | $action_icon = $this->actionIcon; | ||||
| $action_href = $this->actionIconHref; | $action_href = $this->actionIconHref; | ||||
| Show All 30 Lines | |||||