Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | public function render() { | ||||
$owner_phid = $this->getObjectOwnerPHID(); | $owner_phid = $this->getObjectOwnerPHID(); | ||||
if ($viewer_phid) { | if ($viewer_phid) { | ||||
if ($viewer_phid == $owner_phid) { | if ($viewer_phid == $owner_phid) { | ||||
$classes[] = 'viewer-is-object-owner'; | $classes[] = 'viewer-is-object-owner'; | ||||
} | } | ||||
} | } | ||||
$nextprev = null; | $anchor_name = $this->getAnchorName(); | ||||
if (!$this->preview) { | |||||
$nextprev = new PHUIButtonBarView(); | |||||
$nextprev->setBorderless(true); | |||||
$nextprev->addClass('inline-button-divider'); | |||||
$up = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setTooltip(pht('Previous')) | |||||
->setIcon('fa-chevron-up') | |||||
->addSigil('differential-inline-prev') | |||||
->setMustCapture(true); | |||||
$down = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setTooltip(pht('Next')) | |||||
->setIcon('fa-chevron-down') | |||||
->addSigil('differential-inline-next') | |||||
->setMustCapture(true); | |||||
if ($this->canHide()) { | |||||
$hide = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setTooltip(pht('Hide Comment')) | |||||
->setIcon('fa-times') | |||||
->addSigil('hide-inline') | |||||
->setMustCapture(true); | |||||
$nextprev->addButton($hide); | $action_buttons = array(); | ||||
} | |||||
$nextprev->addButton($up); | $can_reply = | ||||
$nextprev->addButton($down); | (!$this->editable) && | ||||
(!$this->preview) && | |||||
($this->allowReply) && | |||||
// NOTE: No product reason why you can't reply to synthetic comments, | |||||
// but the reply mechanism currently sends the inline comment ID to the | |||||
// server, not file/line information, and synthetic comments don't have | |||||
// an inline comment ID. | |||||
(!$is_synthetic); | |||||
$action_buttons = array(); | |||||
if ($this->allowReply) { | |||||
if (!$is_synthetic) { | |||||
// NOTE: No product reason why you can't reply to these, but the reply | |||||
// mechanism currently sends the inline comment ID to the server, not | |||||
// file/line information, and synthetic comments don't have an inline | |||||
// comment ID. | |||||
if ($can_reply) { | |||||
$action_buttons[] = id(new PHUIButtonView()) | $action_buttons[] = id(new PHUIButtonView()) | ||||
->setTag('a') | ->setTag('a') | ||||
->setIcon('fa-reply') | ->setIcon('fa-reply') | ||||
->setTooltip(pht('Reply')) | ->setTooltip(pht('Reply')) | ||||
->addSigil('differential-inline-reply') | ->addSigil('differential-inline-reply') | ||||
->setMustCapture(true); | ->setMustCapture(true); | ||||
} | } | ||||
} | |||||
} | |||||
$anchor_name = $this->getAnchorName(); | |||||
if ($this->editable && !$this->preview) { | if ($this->editable && !$this->preview) { | ||||
$action_buttons[] = id(new PHUIButtonView()) | $action_buttons[] = id(new PHUIButtonView()) | ||||
->setTag('a') | ->setTag('a') | ||||
->setIcon('fa-pencil') | ->setIcon('fa-pencil') | ||||
->setTooltip(pht('Edit')) | ->setTooltip(pht('Edit')) | ||||
->addSigil('differential-inline-edit') | ->addSigil('differential-inline-edit') | ||||
->setMustCapture(true); | ->setMustCapture(true); | ||||
Show All 20 Lines | if ($this->editable && !$this->preview) { | ||||
$action_buttons[] = id(new PHUIButtonView()) | $action_buttons[] = id(new PHUIButtonView()) | ||||
->setTag('a') | ->setTag('a') | ||||
->setTooltip(pht('Delete')) | ->setTooltip(pht('Delete')) | ||||
->setIcon('fa-trash-o') | ->setIcon('fa-trash-o') | ||||
->addSigil('differential-inline-delete') | ->addSigil('differential-inline-delete') | ||||
->setMustCapture(true); | ->setMustCapture(true); | ||||
} | } | ||||
if (!$this->preview && $this->canHide()) { | |||||
$action_buttons[] = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setTooltip(pht('Hide Comment')) | |||||
->setIcon('fa-times') | |||||
->addSigil('hide-inline') | |||||
->setMustCapture(true); | |||||
} | |||||
$done_button = null; | $done_button = null; | ||||
if (!$is_synthetic) { | if (!$is_synthetic) { | ||||
$draft_state = false; | $draft_state = false; | ||||
switch ($inline->getFixedState()) { | switch ($inline->getFixedState()) { | ||||
case PhabricatorInlineCommentInterface::STATE_DRAFT: | case PhabricatorInlineCommentInterface::STATE_DRAFT: | ||||
$is_done = ($this->getCanMarkDone()); | $is_done = ($this->getCanMarkDone()); | ||||
$draft_state = true; | $draft_state = true; | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | $group_right = phutil_tag( | ||||
array( | array( | ||||
'class' => 'inline-head-right', | 'class' => 'inline-head-right', | ||||
), | ), | ||||
array( | array( | ||||
$anchor, | $anchor, | ||||
$done_button, | $done_button, | ||||
$links, | $links, | ||||
$actions, | $actions, | ||||
$nextprev, | |||||
)); | )); | ||||
$markup = javelin_tag( | $markup = javelin_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => $classes, | 'class' => $classes, | ||||
'sigil' => $sigil, | 'sigil' => $sigil, | ||||
'meta' => $metadata, | 'meta' => $metadata, | ||||
), | ), | ||||
array( | array( | ||||
phutil_tag_div('differential-inline-comment-head grouped', array( | javelin_tag( | ||||
'div', | |||||
array( | |||||
'class' => 'differential-inline-comment-head grouped', | |||||
'sigil' => 'differential-inline-header', | |||||
), | |||||
array( | |||||
$group_left, | $group_left, | ||||
$group_right, | $group_right, | ||||
)), | )), | ||||
phutil_tag_div( | phutil_tag_div( | ||||
'differential-inline-comment-content', | 'differential-inline-comment-content', | ||||
phutil_tag_div('phabricator-remarkup', $content)), | phutil_tag_div('phabricator-remarkup', $content)), | ||||
)); | )); | ||||
$summary = phutil_tag( | $summary = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
Show All 37 Lines |