diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ 'names' => array( 'conpherence.pkg.css' => '2f25eb4f', 'conpherence.pkg.js' => '020aebcf', - 'core.pkg.css' => '3471f5d3', + 'core.pkg.css' => 'f66b80a1', 'core.pkg.js' => '2eeda9e0', 'dark-console.pkg.js' => '187792c2', 'differential.pkg.css' => '6d3700f0', @@ -158,7 +158,7 @@ 'rsrc/css/phui/phui-form.css' => '1f177cb7', 'rsrc/css/phui/phui-formation-view.css' => 'd2dec8ed', 'rsrc/css/phui/phui-head-thing.css' => 'd7f293df', - 'rsrc/css/phui/phui-header-view.css' => '36c86a58', + 'rsrc/css/phui/phui-header-view.css' => '5cfd0f9b', 'rsrc/css/phui/phui-hovercard.css' => '39fd2e14', 'rsrc/css/phui/phui-icon-set-selector.css' => '19e0253b', 'rsrc/css/phui/phui-icon.css' => '084ac612', @@ -851,7 +851,7 @@ 'phui-form-view-css' => '57edecb7', 'phui-formation-view-css' => 'd2dec8ed', 'phui-head-thing-view-css' => 'd7f293df', - 'phui-header-view-css' => '36c86a58', + 'phui-header-view-css' => '5cfd0f9b', 'phui-hovercard' => '6199f752', 'phui-hovercard-list' => 'de4b4919', 'phui-hovercard-view-css' => '39fd2e14', diff --git a/src/view/phui/PHUIBoxView.php b/src/view/phui/PHUIBoxView.php --- a/src/view/phui/PHUIBoxView.php +++ b/src/view/phui/PHUIBoxView.php @@ -6,6 +6,7 @@ private $padding = array(); private $border = false; private $color; + private $collapsible; const BLUE = 'phui-box-blue'; const GREY = 'phui-box-grey'; @@ -30,6 +31,17 @@ return $this; } + /** + * Render PHUIBoxView as a
instead of a
HTML tag. + * To be used for collapse/expand in combination with PHUIHeaderView. + * + * @param bool True to wrap in instead of
HTML tag. + */ + public function setCollapsible($collapsible) { + $this->collapsible = $collapsible; + return $this; + } + protected function getTagAttributes() { require_celerity_resource('phui-box-css'); $outer_classes = array(); @@ -51,10 +63,20 @@ $outer_classes[] = $this->color; } - return array('class' => $outer_classes); + $tag_classes = array('class' => $outer_classes); + + if ($this->collapsible) { + $attribute = array('open' => ''); // expand column by default + $tag_classes = array_merge($tag_classes, $attribute); + } + + return $tag_classes; } protected function getTagName() { + if ($this->collapsible) { + return 'details'; + } return 'div'; } diff --git a/src/view/phui/PHUIHeaderView.php b/src/view/phui/PHUIHeaderView.php --- a/src/view/phui/PHUIHeaderView.php +++ b/src/view/phui/PHUIHeaderView.php @@ -24,6 +24,7 @@ private $href; private $actionList; private $actionListID; + private $collapsible; public function setHeader($header) { $this->header = $header; @@ -90,6 +91,17 @@ return $this; } + /** + * Render PHUIHeaderView as a instead of a
HTML tag. + * To be used for collapse/expand in combination with PHUIBoxView. + * + * @param bool True to wrap in instead of
HTML tag. + */ + public function setCollapsible($collapsible) { + $this->collapsible = $collapsible; + return $this; + } + public function setPolicyObject(PhabricatorPolicyInterface $object) { $this->policyObject = $object; return $this; @@ -156,6 +168,9 @@ } protected function getTagName() { + if ($this->collapsible) { + return 'summary'; + } return 'div'; } diff --git a/src/view/phui/PHUIWorkpanelView.php b/src/view/phui/PHUIWorkpanelView.php --- a/src/view/phui/PHUIWorkpanelView.php +++ b/src/view/phui/PHUIWorkpanelView.php @@ -81,7 +81,8 @@ $header = id(new PHUIHeaderView()) ->setHeader($this->header) - ->setSubheader($this->subheader); + ->setSubheader($this->subheader) + ->setCollapsible(true); foreach ($this->headerActions as $action) { $header->addActionItem($action); @@ -112,6 +113,7 @@ $view = id(new PHUIBoxView()) ->setColor(PHUIBoxView::GREY) ->addClass('phui-workpanel-view-inner') + ->setCollapsible(true) ->appendChild( array( $header, diff --git a/webroot/rsrc/css/phui/phui-header-view.css b/webroot/rsrc/css/phui/phui-header-view.css --- a/webroot/rsrc/css/phui/phui-header-view.css +++ b/webroot/rsrc/css/phui/phui-header-view.css @@ -56,6 +56,24 @@ border-top-width: 0; } +details > summary.phui-header-shell { + list-style: none; +} + +details > summary.phui-header-shell::marker { + content: none; +} + +.device-phone details > summary.phui-header-shell::after { + font-family: FontAwesome; + content: "\f061"; +} + +.device-phone details[open] > summary.phui-header-shell::after { + font-family: FontAwesome; + content: "\f063"; +} + .phui-property-list-view + .diviner-document-section { margin-top: -1px; }