From edd8242008be2b140ef0333ca72f298a97106455 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 19 May 2014 12:40:30 -0700 Subject: [PATCH] Don't hide action lists if there are no property list properties Summary: Fixes T5108. If we render a property list with no properties, it doesn't render anything. This hides any attached action list. Instead, insert an empty property if we have an action list but no properties. (This could use some cleanup eventually, but resolve the issue for now.) Test Plan: Viewed a property list with actions but no properties; saw actions. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5108 Differential Revision: https://secure.phabricator.com/D9201 --- src/view/phui/PHUIPropertyListView.php | 33 +++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/view/phui/PHUIPropertyListView.php b/src/view/phui/PHUIPropertyListView.php index 2c5f02dd86..466f83a33b 100644 --- a/src/view/phui/PHUIPropertyListView.php +++ b/src/view/phui/PHUIPropertyListView.php @@ -109,7 +109,28 @@ final class PHUIPropertyListView extends AphrontView { require_celerity_resource('phui-property-list-view-css'); $items = array(); - foreach ($this->parts as $part) { + + $parts = $this->parts; + + // If we have an action list, make sure we render a property part, even + // if there are no properties. Otherwise, the action list won't render. + if ($this->actionList) { + $have_property_part = false; + foreach ($this->parts as $part) { + if ($part['type'] == 'property') { + $have_property_part = true; + break; + } + } + if (!$have_property_part) { + $parts[] = array( + 'type' => 'property', + 'list' => array(), + ); + } + } + + foreach ($parts as $part) { $type = $part['type']; switch ($type) { case 'property': @@ -200,11 +221,11 @@ final class PHUIPropertyListView extends AphrontView { } return phutil_tag( - 'div', - array( - 'class' => 'phui-property-list-container grouped', - ), - array($action_list, $list)); + 'div', + array( + 'class' => 'phui-property-list-container grouped', + ), + array($action_list, $list)); } private function renderSectionPart(array $part) {