Changeset View
Changeset View
Standalone View
Standalone View
src/applications/ponder/controller/PonderQuestionViewController.php
| Show First 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | $can_edit = PhabricatorPolicyFilter::hasCapability( | ||||
| $answer, | $answer, | ||||
| PhabricatorPolicyCapability::CAN_EDIT); | PhabricatorPolicyCapability::CAN_EDIT); | ||||
| $view = id(new PhabricatorActionListView()) | $view = id(new PhabricatorActionListView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setObject($answer) | ->setObject($answer) | ||||
| ->setObjectURI($request->getRequestURI()); | ->setObjectURI($request->getRequestURI()); | ||||
| $user_marked = $answer->getUserVote(); | |||||
| $can_vote = $viewer->isLoggedIn(); | |||||
| if ($user_marked) { | |||||
| $helpful_uri = "/answer/helpful/remove/{$id}/"; | |||||
| $helpful_icon = 'fa-times'; | |||||
| $helpful_text = pht('Remove Helpful'); | |||||
| } else { | |||||
| $helpful_uri = "/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($this->getApplicationURI($helpful_uri)) | |||||
| ->setRenderAsForm(true) | |||||
| ->setDisabled(!$can_vote) | |||||
| ->setWorkflow($can_vote)); | |||||
| $view->addAction( | $view->addAction( | ||||
| id(new PhabricatorActionView()) | id(new PhabricatorActionView()) | ||||
| ->setIcon('fa-pencil') | ->setIcon('fa-pencil') | ||||
| ->setName(pht('Edit Answer')) | ->setName(pht('Edit Answer')) | ||||
| ->setHref($this->getApplicationURI("/answer/edit/{$id}/")) | ->setHref($this->getApplicationURI("/answer/edit/{$id}/")) | ||||
| ->setDisabled(!$can_edit) | ->setDisabled(!$can_edit) | ||||
| ->setWorkflow(!$can_edit)); | ->setWorkflow(!$can_edit)); | ||||
| Show All 15 Lines | $view = id(new PHUIPropertyListView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setObject($answer) | ->setObject($answer) | ||||
| ->setActionList($actions); | ->setActionList($actions); | ||||
| $view->addProperty( | $view->addProperty( | ||||
| pht('Created'), | pht('Created'), | ||||
| phabricator_datetime($answer->getDateCreated(), $viewer)); | phabricator_datetime($answer->getDateCreated(), $viewer)); | ||||
| $view->addProperty( | |||||
| pht('Helpfuls'), | |||||
| $answer->getVoteCount()); | |||||
| $view->invokeWillRenderEvent(); | $view->invokeWillRenderEvent(); | ||||
| $view->addSectionHeader(pht('Answer')); | $view->addSectionHeader(pht('Answer')); | ||||
| $view->addTextContent( | $view->addTextContent( | ||||
| array( | array( | ||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| ▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines | |||||