diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => '7935f211', + 'core.pkg.css' => 'ecdca229', 'core.pkg.js' => '7d8faf57', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '2de124c9', @@ -92,9 +92,9 @@ 'rsrc/css/application/policy/policy-edit.css' => '815c66f7', 'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43', 'rsrc/css/application/policy/policy.css' => '957ea14c', - 'rsrc/css/application/ponder/ponder-view.css' => 'b40dc156', + 'rsrc/css/application/ponder/ponder-view.css' => 'fdd4629b', 'rsrc/css/application/project/project-card-view.css' => '9418c97d', - 'rsrc/css/application/project/project-view.css' => '83bb6654', + 'rsrc/css/application/project/project-view.css' => '298b7c5b', 'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733', 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', 'rsrc/css/application/releeph/releeph-request-differential-create-dialog.css' => '8d8b92cd', @@ -134,7 +134,7 @@ 'rsrc/css/phui/phui-fontkit.css' => '9cda225e', 'rsrc/css/phui/phui-form-view.css' => '4a1a0f5e', 'rsrc/css/phui/phui-form.css' => 'aac1d51d', - 'rsrc/css/phui/phui-header-view.css' => '50c5cb6a', + 'rsrc/css/phui/phui-header-view.css' => 'a6d7b20d', 'rsrc/css/phui/phui-hovercard.css' => 'de1a2119', 'rsrc/css/phui/phui-icon-set-selector.css' => '1ab67aad', 'rsrc/css/phui/phui-icon.css' => '3f33ab57', @@ -154,7 +154,7 @@ 'rsrc/css/phui/phui-status.css' => '888cedb8', 'rsrc/css/phui/phui-tag-view.css' => '9d5d4400', 'rsrc/css/phui/phui-timeline-view.css' => '2efceff8', - 'rsrc/css/phui/phui-two-column-view.css' => '0763177e', + 'rsrc/css/phui/phui-two-column-view.css' => 'a317616a', 'rsrc/css/phui/workboards/phui-workboard-color.css' => 'ac6fe6a7', 'rsrc/css/phui/workboards/phui-workboard.css' => 'e6d89647', 'rsrc/css/phui/workboards/phui-workcard.css' => '3646fb96', @@ -818,7 +818,7 @@ 'phui-fontkit-css' => '9cda225e', 'phui-form-css' => 'aac1d51d', 'phui-form-view-css' => '4a1a0f5e', - 'phui-header-view-css' => '50c5cb6a', + 'phui-header-view-css' => 'a6d7b20d', 'phui-hovercard' => '1bd28176', 'phui-hovercard-view-css' => 'de1a2119', 'phui-icon-set-selector-css' => '1ab67aad', @@ -841,7 +841,7 @@ 'phui-tag-view-css' => '9d5d4400', 'phui-theme-css' => '027ba77e', 'phui-timeline-view-css' => '2efceff8', - 'phui-two-column-view-css' => '0763177e', + 'phui-two-column-view-css' => 'a317616a', 'phui-workboard-color-css' => 'ac6fe6a7', 'phui-workboard-view-css' => 'e6d89647', 'phui-workcard-view-css' => '3646fb96', @@ -855,9 +855,9 @@ 'policy-css' => '957ea14c', 'policy-edit-css' => '815c66f7', 'policy-transaction-detail-css' => '82100a43', - 'ponder-view-css' => 'b40dc156', + 'ponder-view-css' => 'fdd4629b', 'project-card-view-css' => '9418c97d', - 'project-view-css' => '83bb6654', + 'project-view-css' => '298b7c5b', 'releeph-core' => '9b3c5733', 'releeph-preview-branch' => 'b7a6f4a5', 'releeph-request-differential-create-dialog' => '8d8b92cd', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3810,7 +3810,6 @@ 'PonderAnswerCommentController' => 'applications/ponder/controller/PonderAnswerCommentController.php', 'PonderAnswerEditController' => 'applications/ponder/controller/PonderAnswerEditController.php', 'PonderAnswerEditor' => 'applications/ponder/editor/PonderAnswerEditor.php', - 'PonderAnswerHasVotingUserEdgeType' => 'applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php', 'PonderAnswerHistoryController' => 'applications/ponder/controller/PonderAnswerHistoryController.php', 'PonderAnswerMailReceiver' => 'applications/ponder/mail/PonderAnswerMailReceiver.php', 'PonderAnswerPHIDType' => 'applications/ponder/phid/PonderAnswerPHIDType.php', @@ -3828,7 +3827,6 @@ 'PonderDefaultViewCapability' => 'applications/ponder/capability/PonderDefaultViewCapability.php', 'PonderEditor' => 'applications/ponder/editor/PonderEditor.php', 'PonderFooterView' => 'applications/ponder/view/PonderFooterView.php', - 'PonderHelpfulSaveController' => 'applications/ponder/controller/PonderHelpfulSaveController.php', 'PonderModerateCapability' => 'applications/ponder/capability/PonderModerateCapability.php', 'PonderQuestion' => 'applications/ponder/storage/PonderQuestion.php', 'PonderQuestionCommentController' => 'applications/ponder/controller/PonderQuestionCommentController.php', @@ -3850,10 +3848,6 @@ 'PonderQuestionViewController' => 'applications/ponder/controller/PonderQuestionViewController.php', 'PonderRemarkupRule' => 'applications/ponder/remarkup/PonderRemarkupRule.php', 'PonderSchemaSpec' => 'applications/ponder/storage/PonderSchemaSpec.php', - 'PonderVotableInterface' => 'applications/ponder/storage/PonderVotableInterface.php', - 'PonderVote' => 'applications/ponder/constants/PonderVote.php', - 'PonderVoteEditor' => 'applications/ponder/editor/PonderVoteEditor.php', - 'PonderVotingUserHasAnswerEdgeType' => 'applications/ponder/edge/PonderVotingUserHasAnswerEdgeType.php', 'ProjectAddProjectsEmailCommand' => 'applications/project/command/ProjectAddProjectsEmailCommand.php', 'ProjectBoardTaskCard' => 'applications/project/view/ProjectBoardTaskCard.php', 'ProjectCanLockProjectsCapability' => 'applications/project/capability/ProjectCanLockProjectsCapability.php', @@ -8479,7 +8473,6 @@ 'PonderDAO', 'PhabricatorApplicationTransactionInterface', 'PhabricatorMarkupInterface', - 'PonderVotableInterface', 'PhabricatorPolicyInterface', 'PhabricatorFlaggableInterface', 'PhabricatorSubscribableInterface', @@ -8488,7 +8481,6 @@ 'PonderAnswerCommentController' => 'PonderController', 'PonderAnswerEditController' => 'PonderController', 'PonderAnswerEditor' => 'PonderEditor', - 'PonderAnswerHasVotingUserEdgeType' => 'PhabricatorEdgeType', 'PonderAnswerHistoryController' => 'PonderController', 'PonderAnswerMailReceiver' => 'PhabricatorObjectMailReceiver', 'PonderAnswerPHIDType' => 'PhabricatorPHIDType', @@ -8506,7 +8498,6 @@ 'PonderDefaultViewCapability' => 'PhabricatorPolicyCapability', 'PonderEditor' => 'PhabricatorApplicationTransactionEditor', 'PonderFooterView' => 'AphrontTagView', - 'PonderHelpfulSaveController' => 'PonderController', 'PonderModerateCapability' => 'PhabricatorPolicyCapability', 'PonderQuestion' => array( 'PonderDAO', @@ -8540,9 +8531,6 @@ 'PonderQuestionViewController' => 'PonderController', 'PonderRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'PonderSchemaSpec' => 'PhabricatorConfigSchemaSpec', - 'PonderVote' => 'PonderConstants', - 'PonderVoteEditor' => 'PhabricatorEditor', - 'PonderVotingUserHasAnswerEdgeType' => 'PhabricatorEdgeType', 'ProjectAddProjectsEmailCommand' => 'MetaMTAEmailTransactionCommand', 'ProjectBoardTaskCard' => 'Phobject', 'ProjectCanLockProjectsCapability' => 'PhabricatorPolicyCapability', diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -60,6 +60,7 @@ $home = id(new PHUITwoColumnView()) ->setHeader($header) + ->setFluid(true) ->addClass('project-view-home') ->setMainColumn( array( diff --git a/src/applications/ponder/application/PhabricatorPonderApplication.php b/src/applications/ponder/application/PhabricatorPonderApplication.php --- a/src/applications/ponder/application/PhabricatorPonderApplication.php +++ b/src/applications/ponder/application/PhabricatorPonderApplication.php @@ -49,8 +49,6 @@ => 'PonderAnswerCommentController', 'answer/history/(?P\d+)/' => 'PonderAnswerHistoryController', - 'answer/helpful/(?Padd|remove)/(?P[1-9]\d*)/' - => 'PonderHelpfulSaveController', 'question/edit/(?:(?P\d+)/)?' => 'PonderQuestionEditController', 'question/create/' diff --git a/src/applications/ponder/constants/PonderVote.php b/src/applications/ponder/constants/PonderVote.php deleted file mode 100644 --- a/src/applications/ponder/constants/PonderVote.php +++ /dev/null @@ -1,8 +0,0 @@ -getViewer(); - $id = $request->getURIData('id'); - $action = $request->getURIData('action'); - - $answer = id(new PonderAnswerQuery()) - ->setViewer($viewer) - ->withIDs(array($id)) - ->needViewerVotes(true) - ->executeOne(); - - if (!$answer) { - return new Aphront404Response(); - } - - $edit_uri = '/Q'.$answer->getQuestionID(); - - switch ($action) { - case 'add': - $newvote = PonderVote::VOTE_UP; - break; - case 'remove': - $newvote = PonderVote::VOTE_NONE; - break; - } - - if ($request->isFormPost()) { - - $editor = id(new PonderVoteEditor()) - ->setVotable($answer) - ->setActor($viewer) - ->setVote($newvote) - ->saveVote(); - - return id(new AphrontRedirectResponse())->setURI($edit_uri); - } - - if ($action == 'add') { - $title = pht('Mark Answer as Helpful?'); - $body = pht('This answer will be marked as helpful.'); - $button = pht('Mark Helpful'); - } else { - $title = pht('Remove Helpful From Answer?'); - $body = pht('This answer will no longer be marked as helpful.'); - $button = pht('Remove Helpful'); - } - - $dialog = $this->newDialog(); - $dialog->setTitle($title); - $dialog->appendChild($body); - $dialog->addCancelButton($edit_uri); - $dialog->addSubmitButton($button); - - return id(new AphrontDialogResponse())->setDialog($dialog); - } -} 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 @@ -31,6 +31,7 @@ $header->setHeader($question->getTitle()); $header->setUser($viewer); $header->setPolicyObject($question); + $header->setProfileHeader(true); if ($question->getStatus() == PonderQuestionStatus::STATUS_OPEN) { $header->setStatus('fa-square-o', 'bluegrey', pht('Open')); @@ -43,7 +44,32 @@ } $actions = $this->buildActionListView($question); - $properties = $this->buildPropertyListView($question, $actions); + $properties = $this->buildPropertyListView($question); + $details = $this->buildDetailsPropertyView($question); + + $can_edit = PhabricatorPolicyFilter::hasCapability( + $viewer, + $question, + PhabricatorPolicyCapability::CAN_EDIT); + + $edit_uri = '/question/edit/'.$question->getID().'/'; + $edit_button = id(new PHUIButtonView()) + ->setTag('a') + ->setText(pht('Edit')) + ->setHref($this->getApplicationURI($edit_uri)) + ->setIcon('fa-pencil') + ->setDisabled(!$can_edit) + ->setWorkflow(!$can_edit); + + $action_button = id(new PHUIButtonView()) + ->setTag('a') + ->setText(pht('Actions')) + ->setHref('#') + ->setIcon('fa-bars') + ->setDropdownMenu($actions); + + $header->addActionLink($action_button); + $header->addActionLink($edit_button); $content_id = celerity_generate_unique_node_id(); $timeline = $this->buildTransactionTimeline( @@ -55,11 +81,14 @@ $add_comment = id(new PhabricatorApplicationTransactionCommentView()) ->setUser($viewer) ->setObjectPHID($question->getPHID()) + ->setFullWidth(true) ->setShowPreview(false) - ->setHeaderText(pht('Question Comment')) ->setAction($this->getApplicationURI("/question/comment/{$id}/")) ->setSubmitButtonName(pht('Comment')); + $add_comment = phutil_tag_div( + 'ponder-question-add-comment-view', $add_comment); + $comment_view = phutil_tag( 'div', array( @@ -75,38 +104,61 @@ ->setContentID($content_id) ->setCount(count($xactions)); - $object_box = id(new PHUIObjectBoxView()) - ->setHeader($header) - ->addPropertyList($properties) - ->appendChild($footer); - $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()); $crumbs->addTextCrumb('Q'.$id, '/Q'.$id); + $crumbs->setBorder(true); $answer_wiki = null; if ($question->getAnswerWiki()) { - $answer = phutil_tag_div('mlt mlb msr msl', $question->getAnswerWiki()); + $wiki = new PHUIRemarkupView($viewer, $question->getAnswerWiki()); + $wiki_header = phutil_tag( + 'div', + array( + 'class' => 'ponder-answer-wiki-header', + ), + pht('Answer Summary')); + $answer_wiki = id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Answer Summary')) - ->setColor(PHUIObjectBoxView::COLOR_BLUE) - ->appendChild($answer); + ->setBackground(PHUIObjectBoxView::BLUE) + ->appendChild($wiki_header) + ->appendChild($wiki) + ->addClass('ponder-answer-wiki'); } - return $this->buildApplicationPage( + require_celerity_resource('ponder-view-css'); + + $ponder_content = phutil_tag( + 'div', + array( + 'class' => 'ponder-question-content', + ), array( - $crumbs, - $object_box, + $details, + $footer, $comment_view, $answer_wiki, $answers, $answer_add_panel, - ), - array( - 'title' => 'Q'.$question->getID().' '.$question->getTitle(), - 'pageObjects' => array_merge( - array($question->getPHID()), - mpull($question->getAnswers(), 'getPHID')), )); + + $ponder_view = id(new PHUITwoColumnView()) + ->setHeader($header) + ->setMainColumn($ponder_content) + ->setSideColumn($properties) + ->addClass('ponder-question-view'); + + $page_objects = array_merge( + array($question->getPHID()), + mpull($question->getAnswers(), 'getPHID')); + + return $this->newPage() + ->setTitle('Q'.$question->getID().' '.$question->getTitle()) + ->setCrumbs($crumbs) + ->setPageObjectPHIDs($page_objects) + ->appendChild( + array( + $ponder_view, + )); } private function buildActionListView(PonderQuestion $question) { @@ -123,14 +175,6 @@ ->setUser($viewer) ->setObject($question); - $view->addAction( - id(new PhabricatorActionView()) - ->setIcon('fa-pencil') - ->setName(pht('Edit Question')) - ->setHref($this->getApplicationURI("/question/edit/{$id}/")) - ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit)); - if ($question->getStatus() == PonderQuestionStatus::STATUS_OPEN) { $name = pht('Close Question'); $icon = 'fa-check-square-o'; @@ -157,47 +201,87 @@ } private function buildPropertyListView( - PonderQuestion $question, - PhabricatorActionListView $actions) { + PonderQuestion $question) { $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) ->setUser($viewer) ->setObject($question) - ->setActionList($actions); + ->setStacked(true); - $view->addProperty( - pht('Author'), - $viewer->renderHandle($question->getAuthorPHID())); + $view->invokeWillRenderEvent(); - $view->addProperty( - pht('Created'), - phabricator_datetime($question->getDateCreated(), $viewer)); + if (!$view->hasAnyProperties()) { + return null; + } - $view->invokeWillRenderEvent(); + $view = id(new PHUIObjectBoxView()) + ->appendChild($view) + ->setBackground(PHUIObjectBoxView::GREY) + ->addClass('ponder-view-properties'); - $details = PhabricatorMarkupEngine::renderOneObject( - $question, - $question->getMarkupField(), - $viewer); + return $view; + } - if ($details) { - $view->addSectionHeader( - pht('Details'), - PHUIPropertyListView::ICON_SUMMARY); + private function buildDetailsPropertyView( + PonderQuestion $question) { + $viewer = $this->getViewer(); - $view->addTextContent( - array( - phutil_tag( - 'div', - array( - 'class' => 'phabricator-remarkup', - ), - $details), - )); + $question_details = PhabricatorMarkupEngine::renderOneObject( + $question, + $question->getMarkupField(), + $viewer); + + if (!$question_details) { + $question_details = phutil_tag( + 'em', + array(), + pht('No further details for this question.')); } - return $view; + $asker = $viewer->renderHandle($question->getAuthorPHID())->render(); + $date = phabricator_datetime($question->getDateCreated(), $viewer); + $asker = phutil_tag('strong', array(), $asker); + + $author = id(new PhabricatorPeopleQuery()) + ->setViewer($viewer) + ->withPHIDs(array($question->getAuthorPHID())) + ->needProfileImage(true) + ->executeOne(); + + $image_uri = $author->getProfileImageURI(); + $image_href = '/p/'.$author->getUsername(); + + $image = phutil_tag( + 'a', + array( + 'class' => 'ponder-details-author-image', + 'style' => 'background-image: url('.$image_uri.');', + 'href' => $image_href, + )); + + $details_header = phutil_tag( + 'div', + array( + 'class' => 'ponder-details-subtitle', + ), + array( + $image, + pht('Asked by %s on %s.', $asker, $date), + )); + + $details = phutil_tag( + 'div', + array( + 'class' => 'ponder-detail-view', + ), + array( + $details_header, + phutil_tag_div('phabricator-remarkup', $question_details), + )); + + + return $details; } /** @@ -211,32 +295,38 @@ $viewer = $this->getViewer(); $answers = $question->getAnswers(); - $author_phids = mpull($answers, 'getAuthorPHID'); - $handles = $this->loadViewerHandles($author_phids); - $answers_sort = array_reverse(msort($answers, 'getVoteCount')); + if ($answers) { + $author_phids = mpull($answers, 'getAuthorPHID'); + $handles = $this->loadViewerHandles($author_phids); - $view = array(); - foreach ($answers_sort as $answer) { - $id = $answer->getID(); - $handle = $handles[$answer->getAuthorPHID()]; + $view = array(); + foreach ($answers as $answer) { + $id = $answer->getID(); + $handle = $handles[$answer->getAuthorPHID()]; - $timeline = $this->buildTransactionTimeline( - $answer, - id(new PonderAnswerTransactionQuery()) - ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); - $xactions = $timeline->getTransactions(); + $timeline = $this->buildTransactionTimeline( + $answer, + id(new PonderAnswerTransactionQuery()) + ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); + $xactions = $timeline->getTransactions(); - $view[] = id(new PonderAnswerView()) - ->setUser($viewer) - ->setAnswer($answer) - ->setTransactions($xactions) - ->setTimeline($timeline) - ->setHandle($handle); + $view[] = id(new PonderAnswerView()) + ->setUser($viewer) + ->setAnswer($answer) + ->setTransactions($xactions) + ->setTimeline($timeline) + ->setHandle($handle); + } + + $header = id(new PHUIHeaderView()) + ->setHeader('Answers'); + return array($header, $view); } - return $view; + return null; + } } diff --git a/src/applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php b/src/applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php deleted file mode 100644 --- a/src/applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php +++ /dev/null @@ -1,105 +0,0 @@ -answer = $answer; - return $this; - } - - public function setVotable($votable) { - $this->votable = $votable; - return $this; - } - - public function setVote($vote) { - $this->vote = $vote; - return $this; - } - - public function saveVote() { - $actor = $this->requireActor(); - if (!$this->votable) { - throw new PhutilInvalidStateException('setVotable'); - } - - $votable = $this->votable; - $newvote = $this->vote; - - // prepare vote add, or update if this user is amending an - // earlier vote - $editor = id(new PhabricatorEdgeEditor()) - ->addEdge( - $actor->getPHID(), - $votable->getUserVoteEdgeType(), - $votable->getVotablePHID(), - array('data' => $newvote)) - ->removeEdge( - $actor->getPHID(), - $votable->getUserVoteEdgeType(), - $votable->getVotablePHID()); - - $conn = $votable->establishConnection('w'); - $trans = $conn->openTransaction(); - $trans->beginReadLocking(); - - $votable->reload(); - $curvote = (int)PhabricatorEdgeQuery::loadSingleEdgeData( - $actor->getPHID(), - $votable->getUserVoteEdgeType(), - $votable->getVotablePHID()); - - if (!$curvote) { - $curvote = PonderVote::VOTE_NONE; - } - - // Adjust votable's score by this much. - $delta = $newvote - $curvote; - - queryfx($conn, - 'UPDATE %T as t - SET t.voteCount = t.voteCount + %d - WHERE t.PHID = %s', - $votable->getTableName(), - $delta, - $votable->getVotablePHID()); - - $editor->save(); - - $trans->endReadLocking(); - $trans->saveTransaction(); - } -} diff --git a/src/applications/ponder/query/PonderAnswerQuery.php b/src/applications/ponder/query/PonderAnswerQuery.php --- a/src/applications/ponder/query/PonderAnswerQuery.php +++ b/src/applications/ponder/query/PonderAnswerQuery.php @@ -8,9 +8,6 @@ private $authorPHIDs; private $questionIDs; - private $needViewerVotes; - - public function withIDs(array $ids) { $this->ids = $ids; return $this; @@ -31,11 +28,6 @@ return $this; } - public function needViewerVotes($need_viewer_votes) { - $this->needViewerVotes = $need_viewer_votes; - return $this; - } - protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { $where = parent::buildWhereClauseParts($conn); @@ -86,25 +78,6 @@ $answer->attachQuestion($question); } - if ($this->needViewerVotes) { - $viewer_phid = $this->getViewer()->getPHID(); - - $etype = PonderAnswerHasVotingUserEdgeType::EDGECONST; - $edges = id(new PhabricatorEdgeQuery()) - ->withSourcePHIDs(mpull($answers, 'getPHID')) - ->withDestinationPHIDs(array($viewer_phid)) - ->withEdgeTypes(array($etype)) - ->needEdgeData(true) - ->execute(); - foreach ($answers as $answer) { - $user_edge = idx( - $edges[$answer->getPHID()][$etype], - $viewer_phid, - array()); - $answer->attachUserVote($viewer_phid, idx($user_edge, 'data', 0)); - } - } - return $answers; } diff --git a/src/applications/ponder/query/PonderQuestionQuery.php b/src/applications/ponder/query/PonderQuestionQuery.php --- a/src/applications/ponder/query/PonderQuestionQuery.php +++ b/src/applications/ponder/query/PonderQuestionQuery.php @@ -98,7 +98,6 @@ $aquery = id(new PonderAnswerQuery()) ->setViewer($this->getViewer()) ->setOrderVector(array('-id')) - ->needViewerVotes(true) ->withQuestionIDs(mpull($questions, 'getID')); $answers = $aquery->execute(); diff --git a/src/applications/ponder/storage/PonderAnswer.php b/src/applications/ponder/storage/PonderAnswer.php --- a/src/applications/ponder/storage/PonderAnswer.php +++ b/src/applications/ponder/storage/PonderAnswer.php @@ -4,7 +4,6 @@ implements PhabricatorApplicationTransactionInterface, PhabricatorMarkupInterface, - PonderVotableInterface, PhabricatorPolicyInterface, PhabricatorFlaggableInterface, PhabricatorSubscribableInterface, @@ -18,14 +17,10 @@ protected $content; protected $mailKey; protected $status; - protected $voteCount; - private $vote; private $question = self::ATTACHABLE; private $comments; - private $userVotes = array(); - public static function initializeNewAnswer( PhabricatorUser $actor, PonderQuestion $question) { @@ -39,7 +34,7 @@ ->setContent('') ->attachQuestion($question) ->setAuthorPHID($actor->getPHID()) - ->setVoteCount(0) + ->setVoteCount('0') ->setStatus(PonderAnswerStatus::ANSWER_STATUS_VISIBLE); } @@ -57,23 +52,6 @@ return '/Q'.$this->getQuestionID().'#A'.$this->getID(); } - public function setUserVote($vote) { - $this->vote = $vote['data']; - if (!$this->vote) { - $this->vote = PonderVote::VOTE_NONE; - } - return $this; - } - - public function attachUserVote($user_phid, $vote) { - $this->vote = $vote; - return $this; - } - - public function getUserVote() { - return $this->vote; - } - public function setComments($comments) { $this->comments = $comments; return $this; @@ -181,15 +159,6 @@ return (bool)$this->getID(); } - // votable interface - public function getUserVoteEdgeType() { - return PonderVotingUserHasAnswerEdgeType::EDGECONST; - } - - public function getVotablePHID() { - return $this->getPHID(); - } - /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/ponder/storage/PonderVotableInterface.php b/src/applications/ponder/storage/PonderVotableInterface.php deleted file mode 100644 --- a/src/applications/ponder/storage/PonderVotableInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -getAuthorPHID() == $viewer->getPHID()) { - $box_style = 'display: none;'; - $open_link = javelin_tag( - 'a', - array( - 'sigil' => 'reveal-content', - 'class' => 'mml', - 'id' => $hide_action_id, - 'href' => '#', - 'meta' => array( - 'showIDs' => array($show_action_id), - 'hideIDs' => array($hide_action_id), - ), - ), - pht('Add an answer.')); - $own_question = id(new PHUIInfoView()) - ->setSeverity(PHUIInfoView::SEVERITY_WARNING) - ->setID($hide_action_id) - ->appendChild( - pht( - 'This is your own question. You are welcome to provide - an answer if you have found a resolution.')) - ->appendChild($open_link); - } - $header = id(new PHUIHeaderView()) - ->setHeader(pht('Add Answer')); + ->setHeader(pht('New Answer')) + ->addClass('ponder-add-answer-header'); $form = new AphrontFormView(); $form ->setUser($this->user) ->setAction($this->actionURI) ->setWorkflow(true) + ->setFullWidth(true) ->addHiddenInput('question_id', $question->getID()) ->appendChild( id(new PhabricatorRemarkupControl()) @@ -103,22 +77,14 @@ } $box = id(new PHUIObjectBoxView()) - ->setHeader($header) - ->appendChild($form); + ->appendChild($form) + ->setBackground(PHUIObjectBoxView::GREY) + ->addClass('ponder-add-answer-view'); if ($info_panel) { $box->setInfoView($info_panel); } - $box = phutil_tag( - 'div', - array( - 'style' => $box_style, - 'class' => 'mlt', - 'id' => $show_action_id, - ), - $box); - - return array($own_question, $box); + return array($header, $box); } } diff --git a/src/applications/ponder/view/PonderAnswerView.php b/src/applications/ponder/view/PonderAnswerView.php --- a/src/applications/ponder/view/PonderAnswerView.php +++ b/src/applications/ponder/view/PonderAnswerView.php @@ -95,7 +95,7 @@ $content = phutil_tag( 'div', array( - 'class' => 'phabricator-remarkup mlt mlb msr msl', + 'class' => 'phabricator-remarkup', ), PhabricatorMarkupEngine::renderOneObject( $answer, @@ -110,26 +110,14 @@ ->setContentID($content_id) ->setCount(count($this->transactions)); - $votes = $answer->getVoteCount(); - $vote_class = null; - if ($votes > 0) { - $vote_class = 'ponder-footer-action-helpful'; - } - $icon = id(new PHUIIconView()) - ->setIcon('fa-thumbs-up msr'); - $helpful = phutil_tag( - 'span', - array( - 'class' => 'ponder-footer-action '.$vote_class, - ), - array($icon, $votes)); - $footer->addAction($helpful); + $content = phutil_tag_div( + 'ponder-answer-content', array($anchor, $content, $footer)); $answer_view = id(new PHUIObjectBoxView()) ->setHeader($header) - ->appendChild($anchor) - ->appendChild($content) - ->appendChild($footer); + ->setBackground(PHUIObjectBoxView::GREY) + ->addClass('ponder-answer') + ->appendChild($content); $comment_view = id(new PhabricatorApplicationTransactionCommentView()) ->setUser($viewer) @@ -170,28 +158,6 @@ ->setUser($viewer) ->setObject($answer); - $user_marked = $answer->getUserVote(); - $can_vote = $viewer->isLoggedIn(); - - if ($user_marked) { - $helpful_uri = "/ponder/answer/helpful/remove/{$id}/"; - $helpful_icon = 'fa-times'; - $helpful_text = pht('Remove Helpful'); - } else { - $helpful_uri = "/ponder/answer/helpful/add/{$id}/"; - $helpful_icon = 'fa-thumbs-up'; - $helpful_text = pht('Mark as Helpful'); - } - - $view->addAction( - id(new PhabricatorActionView()) - ->setIcon($helpful_icon) - ->setName($helpful_text) - ->setHref($helpful_uri) - ->setRenderAsForm(true) - ->setDisabled(!$can_vote) - ->setWorkflow($can_vote)); - $view->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') diff --git a/src/applications/ponder/view/PonderFooterView.php b/src/applications/ponder/view/PonderFooterView.php --- a/src/applications/ponder/view/PonderFooterView.php +++ b/src/applications/ponder/view/PonderFooterView.php @@ -36,12 +36,8 @@ $content_id = $this->contentID; if ($this->count == 0) { - $icon = id(new PHUIIconView()) - ->setIcon('fa-comments msr'); $text = pht('Add a Comment'); } else { - $icon = id(new PHUIIconView()) - ->setIcon('fa-comments msr'); $text = pht('Show %d Comment(s)', new PhutilNumber($this->count)); } @@ -58,7 +54,7 @@ 'hideIDs' => array($hide_action_id), ), ), - array($icon, $text)); + array($text)); $show_action = javelin_tag( 'a', @@ -73,7 +69,7 @@ 'hideIDs' => array($content_id, $show_action_id), ), ), - array($icon, pht('Hide Comments'))); + array(pht('Hide Comments'))); $actions[] = $hide_action; $actions[] = $show_action; diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -87,6 +87,7 @@ $home = id(new PHUITwoColumnView()) ->setHeader($header) + ->setFluid(true) ->addClass('project-view-home') ->setMainColumn( array( diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -19,6 +19,7 @@ private $objectPHID; private $headerText; private $noPermission; + private $fullWidth; private $currentVersion; private $versionedDraft; @@ -102,6 +103,11 @@ return $this; } + public function setFullWidth($fw) { + $this->fullWidth = $fw; + return $this; + } + public function setCommentActions(array $comment_actions) { assert_instances_of($comment_actions, 'PhabricatorEditEngineCommentAction'); $this->commentActions = $comment_actions; @@ -209,6 +215,7 @@ ->setUser($this->getUser()) ->addSigil('transaction-append') ->setWorkflow(true) + ->setFullWidth($this->fullWidth) ->setMetadata( array( 'objectPHID' => $this->getObjectPHID(), 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 @@ -5,6 +5,7 @@ private $mainColumn; private $sideColumn; private $display; + private $fluid; private $header; const DISPLAY_LEFT = 'phui-side-column-left'; @@ -25,12 +26,17 @@ return $this; } + public function setFluid($fluid) { + $this->fluid = $fluid; + return $this; + } + public function setDisplay($display) { $this->display = $display; return $this; } - public function getDisplay() { + private function getDisplay() { if ($this->display) { return $this->display; } else { @@ -43,6 +49,10 @@ $classes[] = 'phui-two-column-view'; $classes[] = $this->getDisplay(); + if ($this->fluid) { + $classes[] = 'phui-two-column-fluid'; + } + return array( 'class' => implode(' ', $classes), ); @@ -79,6 +89,14 @@ $header = phutil_tag_div('phui-two-column-header', $this->header); } - return array($header, $table); + return phutil_tag( + 'div', + array( + 'class' => 'phui-two-column-container', + ), + array( + $header, + $table, + )); } } diff --git a/webroot/rsrc/css/application/ponder/ponder-view.css b/webroot/rsrc/css/application/ponder/ponder-view.css --- a/webroot/rsrc/css/application/ponder/ponder-view.css +++ b/webroot/rsrc/css/application/ponder/ponder-view.css @@ -2,16 +2,112 @@ * @provides ponder-view-css */ -.ponder-show-comments { - text-align: center; - padding: 8px; - margin: 0 16px; - float: right; - font-weight: bold; +.ponder-question-view { background: #fff; - border-bottom: 1px solid {$blueborder}; - border-left: 1px solid {$lightblueborder}; - border-right: 1px solid {$lightblueborder}; + padding-bottom: 64px; +} + +.device-desktop .ponder-question-view.phui-two-column-view .phui-side-column { + width: 300px; +} + +.ponder-question-view .phui-object-box, +.ponder-question-view .phui-info-view { + margin-left: 0; + margin-right: 0; +} + +.device-phone .ponder-question-view .phui-profile-header.phui-header-shell + .phui-header-header { + font-size: 20px; +} + +.ponder-question-container { + border-top: 1px solid {$thinblueborder}; +} + +.ponder-question-content { + margin: 0 24px; + padding: 24px 0; + border-top: 1px solid rgba({$alphagrey}, .15); +} + +.device-phone .ponder-question-content { + margin: 0 16px; +} + +.device .ponder-view-properties { + border-left: none; + border-right: none; + border-radius: 0; +} + +.device .ponder-question-view .phui-timeline-view, +.device .ponder-question-view .phui-timeline-event-view { + margin: 0; + padding: 0; +} + +.ponder-view-properties .phui-property-list-container { + margin: 0; + padding: 0; +} + +.ponder-question-view .phui-document-container { + border: none; +} + +.ponder-view-properties .phui-property-list-stacked + .phui-property-list-properties .phui-property-list-key { + padding: 0; +} + +.ponder-view-properties .phui-property-list-stacked + .phui-property-list-properties .phui-property-list-value { + margin-bottom: 16px; + padding: 0; +} + +.phui-box.ponder-answer-wiki { + padding: 16px; + margin: 24px 0; +} + +.ponder-details-subtitle { + height: 24px; + line-height: 24px; + margin-bottom: 12px; + color: {$greytext}; + position: relative; + padding-left: 32px; +} + +.ponder-details-subtitle a { + color: {$darkgreytext}; +} + +.ponder-details-author-image { + height: 24px; + width: 24px; + background-size: 100%; + margin-right: 8px; + border-radius: 3px; + display: inline-block; + position: absolute; + top: 0; + left: 0; +} + +.ponder-detail-view .phabricator-remarkup { + margin-left: 32px; +} + +.ponder-question-content .phui-timeline-view { + padding-right: 0; +} + +.ponder-question-content .phui-timeline-view .phui-timeline-core-content { + background-color: {$lightbluebackground}; } .ponder-answer-view { @@ -27,52 +123,102 @@ margin-left: 12px; } -.ponder-answer-view .phui-header-shell { - padding-bottom: 8px; +.ponder-question-view .ponder-answer-view .phui-header-shell { + padding: 4px 8px 3px 8px; +} + +.ponder-answer-view .phui-header-image-href { + display: flex; } .ponder-answer-view .phui-header-view .phui-header-header { - font-size: 16px; + font-size: 15px; } .ponder-answer-view .phui-header-col1 { - width: 45px; + width: 40px; +} + +.ponder-answer-view .ponder-answer-content { + background-color: #fff; + padding: 16px 16px 0 16px; +} + +.device-phone .ponder-answer-view .ponder-answer-content { + padding: 12px 12px 0 12px; } .ponder-answer-view .phui-header-image { - height: 35px; - width: 35px; + height: 30px; + width: 30px; border-radius: 3px; } +.ponder-answer-wiki-header { + font-weight: bold; + border-bottom: 1px solid {$lightblueborder}; + color: {$bluetext}; + padding-bottom: 8px; + margin-bottom: 16px; +} + .ponder-footer-view { - margin: 0 0 -4px; text-align: left; + margin-top: 16px; + border-bottom: 1px solid {$thinblueborder}; +} + +.ponder-answer-view .ponder-footer-view { + margin-top: 24px; + border-top: 1px solid rgba({$alphagrey}, .15); + border-bottom: none; +} + +body .phui-main-column .ponder-question-content .ponder-answer-view + .phui-object-box.ponder-answer { + margin: 0; + padding: 0; } .ponder-footer-view .ponder-footer-action { - padding: 4px 8px; + padding: 8px 0; margin-right: 8px; - color: {$anchor}; display: inline-block; - background-color: rgba({$alphablue}, 0.06); } -.ponder-footer-view .ponder-footer-action.ponder-footer-action-helpful { - background-color: {$lightyellow}; - color: {$bluetext}; +.ponder-add-answer-header { + margin-top: 64px; } -.ponder-footer-view .ponder-footer-action.ponder-footer-action-helpful - .phui-icon-view { - color: {$bluetext}; +.ponder-add-answer-view { + margin-top: 16px; +} + +.ponder-question-content div.ponder-question-add-comment-view + div.phui-box.phui-object-box { + background: {$lightbluebackground}; + margin-right: 0; + margin-left: 32px; +} + +.device .ponder-question-content div.ponder-question-add-comment-view + div.phui-box.phui-object-box { + margin: 0; +} + +.ponder-add-answer-view .phui-form-full-width.phui-form-view + label.aphront-form-label, +.ponder-question-add-comment-view .phui-form-full-width.phui-form-view + label.aphront-form-label{ + display: none; } -.ponder-footer-view .ponder-footer-action .phui-icon-view { - color: {$anchor}; +.ponder-add-answer-view.phui-box-grey .phui-header-shell { + border: none; + padding-bottom: 8px; } -.ponder-footer-view a:hover { - text-decoration: none; - background-color: rgba({$alphablue}, 0.10); +.ponder-add-answer-view .remarkup-assist-textarea, +.ponder-question-add-comment-view .remarkup-assist-textarea { + height: 8em; } diff --git a/webroot/rsrc/css/application/project/project-view.css b/webroot/rsrc/css/application/project/project-view.css --- a/webroot/rsrc/css/application/project/project-view.css +++ b/webroot/rsrc/css/application/project/project-view.css @@ -85,12 +85,9 @@ padding: 4px 8px 0 8px; } -.device-desktop .phui-two-column-view.project-view-badges .phui-side-column { - width: 366px; -} - .project-view-badges .phui-badge-flex-view { background-color: #fff; + width: 340px; } .project-view-home .phui-box-grey .phui-object-item-attribute .phui-icon-view { 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 @@ -98,6 +98,12 @@ font-size: {$normalfontsize}; } +.phui-header-action-link { + margin-bottom: 4px; + margin-top: 4px; + float: right; +} + .device-phone .phui-header-action-link .phui-button-text { visibility: hidden; width: 0; diff --git a/webroot/rsrc/css/phui/phui-two-column-view.css b/webroot/rsrc/css/phui/phui-two-column-view.css --- a/webroot/rsrc/css/phui/phui-two-column-view.css +++ b/webroot/rsrc/css/phui/phui-two-column-view.css @@ -2,6 +2,27 @@ * @provides phui-two-column-view-css */ +.phui-two-column-view { + background-color: #fff; +} + +.phui-two-column-container { + max-width: 1024px; + margin: 0 auto; +} + +.phui-two-column-view .phui-two-column-header .phui-header-shell { + padding-bottom: 32px; +} + +.device-phone .phui-two-column-view .phui-two-column-header .phui-header-shell { + padding-bottom: 20px; +} + +.phui-two-column-fluid .phui-two-column-container { + max-width: 100%; +} + .phui-two-column-content { display: table; width: 100%;