diff --git a/src/applications/herald/controller/HeraldRuleViewController.php b/src/applications/herald/controller/HeraldRuleViewController.php --- a/src/applications/herald/controller/HeraldRuleViewController.php +++ b/src/applications/herald/controller/HeraldRuleViewController.php @@ -34,7 +34,7 @@ $actions = $this->buildActionView($rule); $properties = $this->buildPropertyView($rule); - $details = $this->buildDetailsView($rule); + $details = $this->buildPropertySectionView($rule); $id = $rule->getID(); @@ -55,10 +55,8 @@ $view = id(new PHUITwoColumnView()) ->setHeader($header) - ->setMainColumn(array( - $details, - $timeline, - )) + ->setMainColumn($timeline) + ->addPropertySection(pht('DETAILS'), $details) ->setPropertyList($properties) ->setActionList($actions); @@ -127,7 +125,7 @@ return $view; } - private function buildDetailsView( + private function buildPropertySectionView( HeraldRule $rule) { $viewer = $this->getRequest()->getUser(); @@ -167,10 +165,7 @@ $view->addTextContent($rule_text); } - return id(new PHUIObjectBoxView()) - ->setHeaderText(pht('DETAILS')) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->appendChild($view); + return $view; } } diff --git a/src/applications/passphrase/controller/PassphraseCredentialViewController.php b/src/applications/passphrase/controller/PassphraseCredentialViewController.php --- a/src/applications/passphrase/controller/PassphraseCredentialViewController.php +++ b/src/applications/passphrase/controller/PassphraseCredentialViewController.php @@ -34,12 +34,13 @@ $actions = $this->buildActionView($credential, $type); $properties = $this->buildPropertyView($credential, $type); $subheader = $this->buildSubheaderView($credential); - $content = $this->buildDetailsView($credential, $type); + $content = $this->buildPropertySectionView($credential, $type); $view = id(new PHUITwoColumnView()) ->setHeader($header) ->setSubheader($subheader) - ->setMainColumn(array($content, $timeline)) + ->setMainColumn($timeline) + ->addPropertySection(pht('PROPERTIES'), $content) ->setPropertyList($properties) ->setActionList($actions); @@ -186,7 +187,7 @@ return $actions; } - private function buildDetailsView( + private function buildPropertySectionView( PassphraseCredential $credential, PassphraseCredentialType $type) { $viewer = $this->getRequest()->getUser(); @@ -231,10 +232,7 @@ new PHUIRemarkupView($viewer, $description)); } - return id(new PHUIObjectBoxView()) - ->setHeaderText(pht('PROPERTIES')) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->appendChild($properties); + return $properties; } private function buildPropertyView( diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php --- a/src/applications/ponder/controller/PonderQuestionViewController.php +++ b/src/applications/ponder/controller/PonderQuestionViewController.php @@ -44,7 +44,7 @@ $properties = $this->buildPropertyListView($question); $actions = $this->buildActionListView($question); - $details = $this->buildDetailsPropertyView($question); + $details = $this->buildPropertySectionView($question); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -107,7 +107,6 @@ 'class' => 'ponder-question-content', ), array( - $details, $footer, $comment_view, $answer_wiki, @@ -120,6 +119,7 @@ ->setSubheader($subheader) ->setMainColumn($ponder_content) ->setPropertyList($properties) + ->addPropertySection(pht('DETAILS'), $details) ->setActionList($actions) ->addClass('ponder-question-view'); @@ -222,7 +222,7 @@ ->setContent($content); } - private function buildDetailsPropertyView( + private function buildPropertySectionView( PonderQuestion $question) { $viewer = $this->getViewer(); @@ -241,11 +241,7 @@ $question_details = phutil_tag_div( 'phabricator-remarkup ml', $question_details); - return id(new PHUIObjectBoxView()) - ->setHeaderText(pht('DETAILS')) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setFlush(true) - ->appendChild($question_details); + return $question_details; } /** @@ -274,7 +270,6 @@ ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); $xactions = $timeline->getTransactions(); - $view[] = id(new PonderAnswerView()) ->setUser($viewer) ->setAnswer($answer) diff --git a/src/view/phui/PHUITwoColumnView.php b/src/view/phui/PHUITwoColumnView.php --- a/src/view/phui/PHUITwoColumnView.php +++ b/src/view/phui/PHUITwoColumnView.php @@ -8,6 +8,7 @@ private $fluid; private $header; private $subheader; + private $propertySection = array(); private $actionList; private $propertyList; @@ -34,6 +35,11 @@ return $this; } + public function addPropertySection($title, $section) { + $this->propertySection[] = array($title, $section); + return $this; + } + public function setActionList(PhabricatorActionListView $list) { $this->actionList = $list; return $this; @@ -83,13 +89,7 @@ protected function getTagContent() { require_celerity_resource('phui-two-column-view-css'); - $main = phutil_tag( - 'div', - array( - 'class' => 'phui-main-column', - ), - $this->mainColumn); - + $main = $this->buildMainColumn(); $side = $this->buildSideColumn(); $order = array($side, $main); @@ -123,6 +123,31 @@ )); } + private function buildMainColumn() { + + $view = array(); + $sections = $this->propertySection; + + if ($sections) { + foreach ($sections as $content) { + $view[] = id(new PHUIObjectBoxView()) + ->setHeaderText($content[0]) + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) + ->appendChild($content[1]); + } + } + + return phutil_tag( + 'div', + array( + 'class' => 'phui-main-column', + ), + array( + $view, + $this->mainColumn, + )); + } + private function buildSideColumn() { $property_list = $this->propertyList; $action_list = $this->actionList;