Differential D17480 Diff 42032 src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
| Show First 20 Lines • Show All 232 Lines • ▼ Show 20 Lines | $image = phutil_tag( | ||||
| 'class' => 'phui-comment-image', | 'class' => 'phui-comment-image', | ||||
| )); | )); | ||||
| $wedge = phutil_tag( | $wedge = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'phui-timeline-wedge', | 'class' => 'phui-timeline-wedge', | ||||
| ), | ), | ||||
| ''); | ''); | ||||
| $badge_view = $this->renderBadgeView(); | |||||
| $comment_box = id(new PHUIObjectBoxView()) | $comment_box = id(new PHUIObjectBoxView()) | ||||
| ->setFlush(true) | ->setFlush(true) | ||||
| ->addClass('phui-comment-form-view') | ->addClass('phui-comment-form-view') | ||||
| ->addSigil('phui-comment-form') | ->addSigil('phui-comment-form') | ||||
| ->appendChild($image) | ->appendChild($image) | ||||
| ->appendChild($badge_view) | |||||
| ->appendChild($wedge) | ->appendChild($wedge) | ||||
| ->appendChild($comment); | ->appendChild($comment); | ||||
| return array($comment_box, $preview); | return array($comment_box, $preview); | ||||
| } | } | ||||
| private function renderCommentPanel() { | private function renderCommentPanel() { | ||||
| $draft_comment = ''; | $draft_comment = ''; | ||||
| ▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | foreach ($groups as $group_key => $group_items) { | ||||
| $options[$key] = $item['label']; | $options[$key] = $item['label']; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return $options; | return $options; | ||||
| } | } | ||||
| private function renderBadgeView() { | |||||
| $user = $this->getUser(); | |||||
| $can_use_badges = PhabricatorApplication::isClassInstalledForViewer( | |||||
| 'PhabricatorBadgesApplication', | |||||
| $user); | |||||
| if (!$can_use_badges) { | |||||
| return null; | |||||
| } | |||||
| $awards = id(new PhabricatorBadgesAwardQuery()) | |||||
| ->setViewer($this->getUser()) | |||||
| ->withRecipientPHIDs(array($user->getPHID())) | |||||
| ->setLimit(2) | |||||
| ->execute(); | |||||
| $badge_view = null; | |||||
| if ($awards) { | |||||
| $badges = mpull($awards, 'getBadge'); | |||||
| $badge_list = array(); | |||||
| foreach ($badges as $badge) { | |||||
| $badge_view = id(new PHUIBadgeMiniView()) | |||||
| ->setIcon($badge->getIcon()) | |||||
| ->setQuality($badge->getQuality()) | |||||
| ->setHeader($badge->getName()) | |||||
| ->setTipDirection('E') | |||||
| ->setHref('/badges/view/'.$badge->getID()); | |||||
| $badge_list[] = $badge_view; | |||||
| } | |||||
| $flex = new PHUIBadgeBoxView(); | |||||
| $flex->addItems($badge_list); | |||||
| $flex->setCollapsed(true); | |||||
| $badge_view = phutil_tag( | |||||
| 'div', | |||||
| array( | |||||
| 'class' => 'phui-timeline-badges', | |||||
| ), | |||||
| $flex); | |||||
| } | |||||
| return $badge_view; | |||||
| } | |||||
| } | } | ||||