@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.

Add similiar questions sidebar to Ponder

Summary: Ref T9099. Testing out a two column layout in Ponder, with the main idea being creating a more browsable, discoverable product. I'd like the side column though to be a little smarter and provide project based searching. Ideally, if I'm reading Resolved Maniphest questions, other Resolved Maniphest questions are likely interesting. Another scenario is if I'm answering questions, in which case browsing more Open questions would also be interesting. Ponder "Main Column" still needs to be redesigned.

Test Plan: Browse open questions, resolved questions.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9099

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

+149 -12
+2
resources/celerity/map.php
··· 148 148 'rsrc/css/phui/phui-tag-view.css' => '402691cc', 149 149 'rsrc/css/phui/phui-text.css' => 'cf019f54', 150 150 'rsrc/css/phui/phui-timeline-view.css' => 'f1bccf73', 151 + 'rsrc/css/phui/phui-two-column-view.css' => 'add0a7d1', 151 152 'rsrc/css/phui/phui-workboard-view.css' => '6704d68d', 152 153 'rsrc/css/phui/phui-workpanel-view.css' => 'adec7699', 153 154 'rsrc/css/sprite-login.css' => '1ebb9bf9', ··· 801 802 'phui-text-css' => 'cf019f54', 802 803 'phui-theme-css' => '6b451f24', 803 804 'phui-timeline-view-css' => 'f1bccf73', 805 + 'phui-two-column-view-css' => 'add0a7d1', 804 806 'phui-workboard-view-css' => '6704d68d', 805 807 'phui-workpanel-view-css' => 'adec7699', 806 808 'phuix-action-list-view' => 'b5c256b8',
+2
src/__phutil_library_map__.php
··· 1406 1406 'PHUITimelineEventView' => 'view/phui/PHUITimelineEventView.php', 1407 1407 'PHUITimelineExample' => 'applications/uiexample/examples/PHUITimelineExample.php', 1408 1408 'PHUITimelineView' => 'view/phui/PHUITimelineView.php', 1409 + 'PHUITwoColumnView' => 'view/phui/PHUITwoColumnView.php', 1409 1410 'PHUITypeaheadExample' => 'applications/uiexample/examples/PHUITypeaheadExample.php', 1410 1411 'PHUIWorkboardView' => 'view/phui/PHUIWorkboardView.php', 1411 1412 'PHUIWorkpanelView' => 'view/phui/PHUIWorkpanelView.php', ··· 5183 5184 'PHUITimelineEventView' => 'AphrontView', 5184 5185 'PHUITimelineExample' => 'PhabricatorUIExample', 5185 5186 'PHUITimelineView' => 'AphrontView', 5187 + 'PHUITwoColumnView' => 'AphrontTagView', 5186 5188 'PHUITypeaheadExample' => 'PhabricatorUIExample', 5187 5189 'PHUIWorkboardView' => 'AphrontTagView', 5188 5190 'PHUIWorkpanelView' => 'AphrontTagView',
+10
src/applications/ponder/constants/PonderQuestionStatus.php
··· 26 26 return idx($map, $status, pht('Unknown')); 27 27 } 28 28 29 + public static function getQuestionStatusName($status) { 30 + $map = array( 31 + self::STATUS_OPEN => pht('Open'), 32 + self::STATUS_CLOSED_RESOLVED => pht('Resolved'), 33 + self::STATUS_CLOSED_OBSOLETE => pht('Obsolete'), 34 + self::STATUS_CLOSED_DUPLICATE => pht('Duplicate'), 35 + ); 36 + return idx($map, $status, pht('Unknown')); 37 + } 38 + 29 39 public static function getQuestionStatusDescription($status) { 30 40 $map = array( 31 41 self::STATUS_OPEN =>
+54 -12
src/applications/ponder/controller/PonderQuestionViewController.php
··· 10 10 ->setViewer($viewer) 11 11 ->withIDs(array($id)) 12 12 ->needAnswers(true) 13 + ->needProjectPHIDs(true) 13 14 ->executeOne(); 14 15 if (!$question) { 15 16 return new Aphront404Response(); ··· 51 52 52 53 $actions = $this->buildActionListView($question); 53 54 $properties = $this->buildPropertyListView($question, $actions); 55 + $sidebar = $this->buildSidebar($question); 54 56 55 57 $object_box = id(new PHUIObjectBoxView()) 56 58 ->setHeader($header) ··· 59 61 $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()); 60 62 $crumbs->addTextCrumb('Q'.$id, '/Q'.$id); 61 63 62 - $ponder_view = phutil_tag( 63 - 'div', 64 - array( 65 - 'class' => 'ponder-question-view', 66 - ), 67 - array( 68 - $crumbs, 69 - $object_box, 70 - $question_xactions, 71 - $answers, 72 - $answer_add_panel, 73 - )); 64 + $ponder_view = id(new PHUITwoColumnView()) 65 + ->setMainColumn(array( 66 + $object_box, 67 + $question_xactions, 68 + $answers, 69 + $answer_add_panel, 70 + )) 71 + ->setSideColumn($sidebar) 72 + ->addClass('ponder-question-view'); 74 73 75 74 return $this->buildApplicationPage( 76 75 array( 76 + $crumbs, 77 77 $ponder_view, 78 78 ), 79 79 array( ··· 408 408 $stuff); 409 409 410 410 return array($show, $hide); 411 + } 412 + 413 + private function buildSidebar(PonderQuestion $question) { 414 + $viewer = $this->getViewer(); 415 + $status = $question->getStatus(); 416 + $id = $question->getID(); 417 + 418 + $questions = id(new PonderQuestionQuery()) 419 + ->setViewer($viewer) 420 + ->withStatuses(array($status)) 421 + ->withEdgeLogicPHIDs( 422 + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, 423 + PhabricatorQueryConstraint::OPERATOR_OR, 424 + $question->getProjectPHIDs()) 425 + ->setLimit(10) 426 + ->execute(); 427 + 428 + $list = id(new PHUIObjectItemListView()) 429 + ->setUser($viewer) 430 + ->setNoDataString(pht('No similar questions found.')); 431 + 432 + foreach ($questions as $question) { 433 + if ($id == $question->getID()) { 434 + continue; 435 + } 436 + $item = new PHUIObjectItemView(); 437 + $item->setObjectName('Q'.$question->getID()); 438 + $item->setHeader($question->getTitle()); 439 + $item->setHref('/Q'.$question->getID()); 440 + $item->setObject($question); 441 + 442 + $item->addAttribute( 443 + pht('%d Answer(s)', $question->getAnswerCount())); 444 + 445 + $list->addItem($item); 446 + } 447 + 448 + $box = id(new PHUIObjectBoxView()) 449 + ->setHeaderText(pht('Similar Questions')) 450 + ->setObjectList($list); 451 + 452 + return $box; 411 453 } 412 454 413 455 }
+48
src/view/phui/PHUITwoColumnView.php
··· 1 + <?php 2 + 3 + final class PHUITwoColumnView extends AphrontTagView { 4 + 5 + private $mainColumn; 6 + private $sideColumn; 7 + 8 + public function setMainColumn($main) { 9 + $this->mainColumn = $main; 10 + return $this; 11 + } 12 + 13 + public function setSideColumn($side) { 14 + $this->sideColumn = $side; 15 + return $this; 16 + } 17 + 18 + protected function getTagAttributes() { 19 + return array( 20 + 'class' => 'phui-two-column-view grouped', 21 + ); 22 + } 23 + 24 + protected function getTagContent() { 25 + require_celerity_resource('phui-two-column-view-css'); 26 + 27 + $main = phutil_tag( 28 + 'div', 29 + array( 30 + 'class' => 'phui-main-column', 31 + ), 32 + $this->mainColumn); 33 + 34 + $side = phutil_tag( 35 + 'div', 36 + array( 37 + 'class' => 'phui-side-column', 38 + ), 39 + $this->sideColumn); 40 + 41 + return phutil_tag_div( 42 + 'phui-two-column-row', 43 + array( 44 + $main, 45 + $side, 46 + )); 47 + } 48 + }
+33
webroot/rsrc/css/phui/phui-two-column-view.css
··· 1 + /** 2 + * @provides phui-two-column-view-css 3 + */ 4 + 5 + .phui-two-column-view { 6 + display: table; 7 + width: 100%; 8 + } 9 + 10 + .phui-two-column-row { 11 + display: table-row; 12 + } 13 + 14 + .device-desktop .phui-two-column-view .phui-main-column { 15 + display: table-cell; 16 + vertical-align: top; 17 + } 18 + 19 + .device-desktop .phui-two-column-view .phui-side-column { 20 + width: 320px; 21 + display: table-cell; 22 + vertical-align: top; 23 + } 24 + 25 + .device-desktop .phui-two-column-view 26 + .phui-main-column .phui-object-box:first-child { 27 + margin: 0 16px 0 16px; 28 + } 29 + 30 + .device-desktop .phui-two-column-view 31 + .phui-side-column .phui-object-box:first-child { 32 + margin: 0 16px 16px 0; 33 + }