Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
| <?php | <?php | ||||
| final class PHUIDiffInlineCommentDetailView | final class PHUIDiffInlineCommentDetailView | ||||
| extends PHUIDiffInlineCommentView { | extends PHUIDiffInlineCommentView { | ||||
| private $inlineComment; | private $inlineComment; | ||||
| private $handles; | private $handles; | ||||
| private $markupEngine; | private $markupEngine; | ||||
| private $editable; | private $editable; | ||||
| private $preview; | private $preview; | ||||
| private $allowReply; | private $allowReply; | ||||
| private $renderer; | private $renderer; | ||||
| private $canMarkDone; | |||||
| public function setInlineComment(PhabricatorInlineCommentInterface $comment) { | public function setInlineComment(PhabricatorInlineCommentInterface $comment) { | ||||
| $this->inlineComment = $comment; | $this->inlineComment = $comment; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setHandles(array $handles) { | public function setHandles(array $handles) { | ||||
| assert_instances_of($handles, 'PhabricatorObjectHandle'); | assert_instances_of($handles, 'PhabricatorObjectHandle'); | ||||
| Show All 25 Lines | public function setRenderer($renderer) { | ||||
| $this->renderer = $renderer; | $this->renderer = $renderer; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getRenderer() { | public function getRenderer() { | ||||
| return $this->renderer; | return $this->renderer; | ||||
| } | } | ||||
| public function setCanMarkDone($can_mark_done) { | |||||
| $this->canMarkDone = $can_mark_done; | |||||
| return $this; | |||||
| } | |||||
| public function getCanMarkDone() { | |||||
| return $this->canMarkDone; | |||||
| } | |||||
| public function render() { | public function render() { | ||||
| $inline = $this->inlineComment; | $inline = $this->inlineComment; | ||||
| $start = $inline->getLineNumber(); | $start = $inline->getLineNumber(); | ||||
| $length = $inline->getLineLength(); | $length = $inline->getLineLength(); | ||||
| if ($length) { | if ($length) { | ||||
| $end = $start + $length; | $end = $start + $length; | ||||
| ▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | if ($this->editable && !$this->preview) { | ||||
| array( | array( | ||||
| 'href' => '#', | 'href' => '#', | ||||
| 'mustcapture' => true, | 'mustcapture' => true, | ||||
| 'sigil' => 'differential-inline-delete', | 'sigil' => 'differential-inline-delete', | ||||
| ), | ), | ||||
| pht('Delete')); | pht('Delete')); | ||||
| } | } | ||||
| if (!$is_synthetic) { | |||||
| switch ($inline->getFixedState()) { | |||||
| case PhabricatorInlineCommentInterface::STATE_DRAFT: | |||||
| $is_done = ($this->getCanMarkDone()); | |||||
| break; | |||||
| case PhabricatorInlineCommentInterface::STATE_UNDRAFT: | |||||
| $is_done = !($this->getCanMarkDone()); | |||||
| break; | |||||
| case PhabricatorInlineCommentInterface::STATE_DONE: | |||||
| $is_done = true; | |||||
| break; | |||||
| default: | |||||
| case PhabricatorInlineCommentInterface::STATE_UNDONE: | |||||
| $is_done = false; | |||||
| break; | |||||
| } | |||||
| $links[] = javelin_tag( | |||||
| 'input', | |||||
| array( | |||||
| 'type' => 'checkbox', | |||||
| 'checked' => ($is_done ? 'checked' : null), | |||||
| 'disabled' => ($this->getCanMarkDone() ? null : 'disabled'), | |||||
| 'class' => 'differential-inline-done', | |||||
| 'sigil' => 'differential-inline-done', | |||||
| )); | |||||
| } | |||||
| if ($links) { | if ($links) { | ||||
| $links = phutil_tag( | $links = phutil_tag( | ||||
| 'span', | 'span', | ||||
| array('class' => 'differential-inline-comment-links'), | array('class' => 'differential-inline-comment-links'), | ||||
| phutil_implode_html(" \xC2\xB7 ", $links)); | phutil_implode_html(" \xC2\xB7 ", $links)); | ||||
| } else { | } else { | ||||
| $links = null; | $links = null; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||