Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIWorkpanelView.php
<?php | <?php | ||||
final class PHUIWorkpanelView extends AphrontView { | final class PHUIWorkpanelView extends AphrontView { | ||||
private $cards = array(); | private $cards = array(); | ||||
private $header; | private $header; | ||||
private $editURI; | private $editURI; | ||||
private $footerAction; | private $footerAction; | ||||
private $headerColor = PhabricatorActionHeaderView::HEADER_GREY; | |||||
public function setCards(PHUIObjectItemListView $cards) { | public function setCards(PHUIObjectItemListView $cards) { | ||||
$this->cards[] = $cards; | $this->cards[] = $cards; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setHeader($header) { | public function setHeader($header) { | ||||
$this->header = $header; | $this->header = $header; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setEditURI($edit_uri) { | public function setEditURI($edit_uri) { | ||||
$this->editURI = $edit_uri; | $this->editURI = $edit_uri; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setFooterAction(PHUIListItemView $footer_action) { | public function setFooterAction(PHUIListItemView $footer_action) { | ||||
$this->footerAction = $footer_action; | $this->footerAction = $footer_action; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setHeaderColor($header_color) { | |||||
$this->headerColor = $header_color; | |||||
return $this; | |||||
} | |||||
public function render() { | public function render() { | ||||
require_celerity_resource('phui-workpanel-view-css'); | require_celerity_resource('phui-workpanel-view-css'); | ||||
$footer = ''; | $footer = ''; | ||||
if ($this->footerAction) { | if ($this->footerAction) { | ||||
$footer_tag = $this->footerAction; | $footer_tag = $this->footerAction; | ||||
$footer = phutil_tag( | $footer = phutil_tag( | ||||
'ul', | 'ul', | ||||
array( | array( | ||||
'class' => 'phui-workpanel-footer-action mst ps' | 'class' => 'phui-workpanel-footer-action mst ps' | ||||
), | ), | ||||
$footer_tag); | $footer_tag); | ||||
} | } | ||||
$header_edit = id(new PHUIIconView()) | $header_edit = id(new PHUIIconView()) | ||||
->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS) | ->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS) | ||||
->setSpriteIcon('settings-grey') | ->setSpriteIcon('settings-grey') | ||||
->setHref($this->editURI); | ->setHref($this->editURI); | ||||
$header = id(new PhabricatorActionHeaderView()) | $header = id(new PhabricatorActionHeaderView()) | ||||
->setHeaderTitle($this->header) | ->setHeaderTitle($this->header) | ||||
->setHeaderColor(PhabricatorActionHeaderView::HEADER_GREY) | ->setHeaderColor($this->headerColor) | ||||
->addAction($header_edit); | ->addAction($header_edit); | ||||
$body = phutil_tag( | $body = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'phui-workpanel-body' | 'class' => 'phui-workpanel-body' | ||||
), | ), | ||||
$this->cards); | $this->cards); | ||||
Show All 20 Lines |