Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIHeaderView.php
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | final class PHUIHeaderView extends AphrontTagView { | ||||
} | } | ||||
public function setButtonBar(PHUIButtonBarView $bb) { | public function setButtonBar(PHUIButtonBarView $bb) { | ||||
$this->buttonBar = $bb; | $this->buttonBar = $bb; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setStatus($icon, $color, $name) { | public function setStatus($icon, $color, $name) { | ||||
$header_class = 'phui-header-status'; | |||||
if ($color) { | // TODO: Normalize "closed/archived" to constants. | ||||
$icon = $icon.' '.$color; | if ($color == 'dark') { | ||||
$header_class = $header_class.'-'.$color; | $color = PHUITagView::COLOR_INDIGO; | ||||
} | } | ||||
$img = id(new PHUIIconView()) | $tag = id(new PHUITagView()) | ||||
->setIcon($icon); | ->setName($name) | ||||
->setIcon($icon) | |||||
$tag = phutil_tag( | ->setShade($color) | ||||
'span', | ->setType(PHUITagView::TYPE_SHADE); | ||||
array( | |||||
'class' => "phui-header-status {$header_class}", | |||||
), | |||||
array( | |||||
$img, | |||||
$name, | |||||
)); | |||||
return $this->addProperty(self::PROPERTY_STATUS, $tag); | return $this->addProperty(self::PROPERTY_STATUS, $tag); | ||||
} | } | ||||
public function setEpoch($epoch) { | public function setEpoch($epoch) { | ||||
$age = time() - $epoch; | $age = time() - $epoch; | ||||
$age = floor($age / (60 * 60 * 24)); | $age = floor($age / (60 * 60 * 24)); | ||||
if ($age < 1) { | if ($age < 1) { | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | if ($this->buttonBar) { | ||||
$right[] = phutil_tag( | $right[] = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'phui-header-action-links', | 'class' => 'phui-header-action-links', | ||||
), | ), | ||||
$this->buttonBar); | $this->buttonBar); | ||||
} | } | ||||
if ($this->actionIcons || $this->tags) { | if ($this->actionIcons) { | ||||
$action_list = array(); | $action_list = array(); | ||||
if ($this->actionIcons) { | if ($this->actionIcons) { | ||||
foreach ($this->actionIcons as $icon) { | foreach ($this->actionIcons as $icon) { | ||||
$action_list[] = phutil_tag( | $action_list[] = phutil_tag( | ||||
'li', | 'li', | ||||
array( | array( | ||||
'class' => 'phui-header-action-icon', | 'class' => 'phui-header-action-icon', | ||||
), | ), | ||||
$icon); | $icon); | ||||
} | } | ||||
} | } | ||||
if ($this->tags) { | |||||
$action_list[] = phutil_tag( | |||||
'li', | |||||
array( | |||||
'class' => 'phui-header-action-tag', | |||||
), | |||||
array_interleave(' ', $this->tags)); | |||||
} | |||||
$right[] = phutil_tag( | $right[] = phutil_tag( | ||||
'ul', | 'ul', | ||||
array( | array( | ||||
'class' => 'phui-header-action-list', | 'class' => 'phui-header-action-list', | ||||
), | ), | ||||
$action_list); | $action_list); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | if ($this->properties || $this->policyObject) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if ($this->policyObject) { | if ($this->policyObject) { | ||||
$property_list[] = $this->renderPolicyProperty($this->policyObject); | $property_list[] = $this->renderPolicyProperty($this->policyObject); | ||||
} | } | ||||
if ($this->tags) { | |||||
$property_list[] = $this->tags; | |||||
} | |||||
$left[] = phutil_tag( | $left[] = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'phui-header-subheader', | 'class' => 'phui-header-subheader', | ||||
), | ), | ||||
$property_list); | $property_list); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |