Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIObjectItemView.php
| Show All 22 Lines | final class PHUIObjectItemView extends AphrontTagView { | ||||
| private $imageIcon; | private $imageIcon; | ||||
| private $titleText; | private $titleText; | ||||
| private $badge; | private $badge; | ||||
| private $countdownNum; | private $countdownNum; | ||||
| private $countdownNoun; | private $countdownNoun; | ||||
| private $sideColumn; | private $sideColumn; | ||||
| private $coverImage; | private $coverImage; | ||||
| private $description; | private $description; | ||||
| private $clickable; | |||||
| private $selectableName; | private $selectableName; | ||||
| private $selectableValue; | private $selectableValue; | ||||
| private $isSelected; | private $isSelected; | ||||
| private $isForbidden; | private $isForbidden; | ||||
| public function setDisabled($disabled) { | public function setDisabled($disabled) { | ||||
| $this->disabled = $disabled; | $this->disabled = $disabled; | ||||
| ▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | public function setSelectable( | ||||
| $this->selectableName = $name; | $this->selectableName = $name; | ||||
| $this->selectableValue = $value; | $this->selectableValue = $value; | ||||
| $this->isSelected = $is_selected; | $this->isSelected = $is_selected; | ||||
| $this->isForbidden = $is_forbidden; | $this->isForbidden = $is_forbidden; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setClickable($clickable) { | |||||
| $this->clickable = $clickable; | |||||
| return $this; | |||||
| } | |||||
| public function getClickable() { | |||||
| return $this->clickable; | |||||
| } | |||||
| public function setEpoch($epoch) { | public function setEpoch($epoch) { | ||||
| $date = phabricator_datetime($epoch, $this->getUser()); | $date = phabricator_datetime($epoch, $this->getUser()); | ||||
| $this->addIcon('none', $date); | $this->addIcon('none', $date); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function addAction(PHUIListItemView $action) { | public function addAction(PHUIListItemView $action) { | ||||
| if (count($this->actions) >= 3) { | if (count($this->actions) >= 3) { | ||||
| ▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | protected function getTagAttributes() { | ||||
| if ($this->getImageURI()) { | if ($this->getImageURI()) { | ||||
| $item_classes[] = 'phui-oi-with-image'; | $item_classes[] = 'phui-oi-with-image'; | ||||
| } | } | ||||
| if ($this->getImageIcon()) { | if ($this->getImageIcon()) { | ||||
| $item_classes[] = 'phui-oi-with-image-icon'; | $item_classes[] = 'phui-oi-with-image-icon'; | ||||
| } | } | ||||
| if ($this->getClickable()) { | |||||
| Javelin::initBehavior('linked-container'); | |||||
| $item_classes[] = 'phui-oi-linked-container'; | |||||
| $sigils[] = 'linked-container'; | |||||
| } | |||||
| return array( | return array( | ||||
| 'class' => $item_classes, | 'class' => $item_classes, | ||||
| 'sigil' => $sigils, | 'sigil' => $sigils, | ||||
| ); | ); | ||||
| } | } | ||||
| protected function getTagContent() { | protected function getTagContent() { | ||||
| $viewer = $this->getUser(); | $viewer = $this->getUser(); | ||||
| ▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | if ($this->icons) { | ||||
| $label = phutil_tag( | $label = phutil_tag( | ||||
| 'span', | 'span', | ||||
| array( | array( | ||||
| 'class' => 'phui-oi-icon-label', | 'class' => 'phui-oi-icon-label', | ||||
| ), | ), | ||||
| $spec['label']); | $spec['label']); | ||||
| if (isset($spec['attributes']['href'])) { | |||||
| $icon_href = phutil_tag( | |||||
| 'a', | |||||
| array('href' => $spec['attributes']['href']), | |||||
| array($icon, $label)); | |||||
| } else { | |||||
| $icon_href = array($icon, $label); | |||||
epriestley: D19871 corrects the accidental omission of `$label` here when simplifying the UI element. | |||||
| } | |||||
Done Inline ActionsThis is an existing hack-around for the problem described in the summary, which links the text and separately links the icon in UIs like the /drydock/ console. Since the entire element how acts like a link, I removed this screenreader-hostile secondary supplemental link. epriestley: This is an existing hack-around for the problem described in the summary, which links the text… | |||||
| $classes = array(); | $classes = array(); | ||||
| $classes[] = 'phui-oi-icon'; | $classes[] = 'phui-oi-icon'; | ||||
| if (isset($spec['attributes']['class'])) { | if (isset($spec['attributes']['class'])) { | ||||
| $classes[] = $spec['attributes']['class']; | $classes[] = $spec['attributes']['class']; | ||||
| } | } | ||||
| $icon_list[] = javelin_tag( | $icon_list[] = javelin_tag( | ||||
| 'li', | 'li', | ||||
| array( | array( | ||||
| 'class' => implode(' ', $classes), | 'class' => implode(' ', $classes), | ||||
| ), | ), | ||||
| $icon_href); | $icon); | ||||
| } | } | ||||
| $icons[] = phutil_tag( | $icons[] = phutil_tag( | ||||
| 'ul', | 'ul', | ||||
| array( | array( | ||||
| 'class' => 'phui-oi-icons', | 'class' => 'phui-oi-icons', | ||||
| ), | ), | ||||
| $icon_list); | $icon_list); | ||||
| ▲ Show 20 Lines • Show All 366 Lines • Show Last 20 Lines | |||||
D19871 corrects the accidental omission of $label here when simplifying the UI element.