@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Give PHUITwoColumnView an addPropertySection method

Summary: Simplifies building pages a little more, adds a helper method to just add a property section to the main column automatically above other content.

Test Plan: Review Ponder, Herald, Passphrase, Countdown.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15377

+46 -33
+5 -10
src/applications/herald/controller/HeraldRuleViewController.php
··· 34 34 35 35 $actions = $this->buildActionView($rule); 36 36 $properties = $this->buildPropertyView($rule); 37 - $details = $this->buildDetailsView($rule); 37 + $details = $this->buildPropertySectionView($rule); 38 38 39 39 $id = $rule->getID(); 40 40 ··· 55 55 56 56 $view = id(new PHUITwoColumnView()) 57 57 ->setHeader($header) 58 - ->setMainColumn(array( 59 - $details, 60 - $timeline, 61 - )) 58 + ->setMainColumn($timeline) 59 + ->addPropertySection(pht('DETAILS'), $details) 62 60 ->setPropertyList($properties) 63 61 ->setActionList($actions); 64 62 ··· 127 125 return $view; 128 126 } 129 127 130 - private function buildDetailsView( 128 + private function buildPropertySectionView( 131 129 HeraldRule $rule) { 132 130 133 131 $viewer = $this->getRequest()->getUser(); ··· 167 165 $view->addTextContent($rule_text); 168 166 } 169 167 170 - return id(new PHUIObjectBoxView()) 171 - ->setHeaderText(pht('DETAILS')) 172 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 173 - ->appendChild($view); 168 + return $view; 174 169 } 175 170 176 171 }
+5 -7
src/applications/passphrase/controller/PassphraseCredentialViewController.php
··· 34 34 $actions = $this->buildActionView($credential, $type); 35 35 $properties = $this->buildPropertyView($credential, $type); 36 36 $subheader = $this->buildSubheaderView($credential); 37 - $content = $this->buildDetailsView($credential, $type); 37 + $content = $this->buildPropertySectionView($credential, $type); 38 38 39 39 $view = id(new PHUITwoColumnView()) 40 40 ->setHeader($header) 41 41 ->setSubheader($subheader) 42 - ->setMainColumn(array($content, $timeline)) 42 + ->setMainColumn($timeline) 43 + ->addPropertySection(pht('PROPERTIES'), $content) 43 44 ->setPropertyList($properties) 44 45 ->setActionList($actions); 45 46 ··· 186 187 return $actions; 187 188 } 188 189 189 - private function buildDetailsView( 190 + private function buildPropertySectionView( 190 191 PassphraseCredential $credential, 191 192 PassphraseCredentialType $type) { 192 193 $viewer = $this->getRequest()->getUser(); ··· 231 232 new PHUIRemarkupView($viewer, $description)); 232 233 } 233 234 234 - return id(new PHUIObjectBoxView()) 235 - ->setHeaderText(pht('PROPERTIES')) 236 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 237 - ->appendChild($properties); 235 + return $properties; 238 236 } 239 237 240 238 private function buildPropertyView(
+4 -9
src/applications/ponder/controller/PonderQuestionViewController.php
··· 44 44 45 45 $properties = $this->buildPropertyListView($question); 46 46 $actions = $this->buildActionListView($question); 47 - $details = $this->buildDetailsPropertyView($question); 47 + $details = $this->buildPropertySectionView($question); 48 48 49 49 $can_edit = PhabricatorPolicyFilter::hasCapability( 50 50 $viewer, ··· 107 107 'class' => 'ponder-question-content', 108 108 ), 109 109 array( 110 - $details, 111 110 $footer, 112 111 $comment_view, 113 112 $answer_wiki, ··· 120 119 ->setSubheader($subheader) 121 120 ->setMainColumn($ponder_content) 122 121 ->setPropertyList($properties) 122 + ->addPropertySection(pht('DETAILS'), $details) 123 123 ->setActionList($actions) 124 124 ->addClass('ponder-question-view'); 125 125 ··· 222 222 ->setContent($content); 223 223 } 224 224 225 - private function buildDetailsPropertyView( 225 + private function buildPropertySectionView( 226 226 PonderQuestion $question) { 227 227 $viewer = $this->getViewer(); 228 228 ··· 241 241 $question_details = phutil_tag_div( 242 242 'phabricator-remarkup ml', $question_details); 243 243 244 - return id(new PHUIObjectBoxView()) 245 - ->setHeaderText(pht('DETAILS')) 246 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 247 - ->setFlush(true) 248 - ->appendChild($question_details); 244 + return $question_details; 249 245 } 250 246 251 247 /** ··· 273 269 id(new PonderAnswerTransactionQuery()) 274 270 ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); 275 271 $xactions = $timeline->getTransactions(); 276 - 277 272 278 273 $view[] = id(new PonderAnswerView()) 279 274 ->setUser($viewer)
+32 -7
src/view/phui/PHUITwoColumnView.php
··· 8 8 private $fluid; 9 9 private $header; 10 10 private $subheader; 11 + private $propertySection = array(); 11 12 private $actionList; 12 13 private $propertyList; 13 14 ··· 31 32 32 33 public function setSubheader($subheader) { 33 34 $this->subheader = $subheader; 35 + return $this; 36 + } 37 + 38 + public function addPropertySection($title, $section) { 39 + $this->propertySection[] = array($title, $section); 34 40 return $this; 35 41 } 36 42 ··· 83 89 protected function getTagContent() { 84 90 require_celerity_resource('phui-two-column-view-css'); 85 91 86 - $main = phutil_tag( 87 - 'div', 88 - array( 89 - 'class' => 'phui-main-column', 90 - ), 91 - $this->mainColumn); 92 - 92 + $main = $this->buildMainColumn(); 93 93 $side = $this->buildSideColumn(); 94 94 $order = array($side, $main); 95 95 ··· 120 120 $header, 121 121 $subheader, 122 122 $table, 123 + )); 124 + } 125 + 126 + private function buildMainColumn() { 127 + 128 + $view = array(); 129 + $sections = $this->propertySection; 130 + 131 + if ($sections) { 132 + foreach ($sections as $content) { 133 + $view[] = id(new PHUIObjectBoxView()) 134 + ->setHeaderText($content[0]) 135 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 136 + ->appendChild($content[1]); 137 + } 138 + } 139 + 140 + return phutil_tag( 141 + 'div', 142 + array( 143 + 'class' => 'phui-main-column', 144 + ), 145 + array( 146 + $view, 147 + $this->mainColumn, 123 148 )); 124 149 } 125 150