revision = $revision; return $this; } public function setActions(array $actions) { $this->actions = $actions; return $this; } public function setActionURI($uri) { $this->actionURI = $uri; } public function setUser(PhabricatorUser $user) { $this->user = $user; } public function setDraft($draft) { $this->draft = $draft; return $this; } public function render() { require_celerity_resource('differential-revision-add-comment-css'); $revision = $this->revision; $actions = array(); foreach ($this->actions as $action) { $actions[$action] = DifferentialAction::getActionVerb($action); } $form = new AphrontFormView(); $form ->setUser($this->user) ->setAction($this->actionURI) ->addHiddenInput('revision_id', $revision->getID()) ->appendChild( id(new AphrontFormSelectControl()) ->setLabel('Action') ->setName('action') ->setID('comment-action') ->setOptions($actions)) ->appendChild( id(new AphrontFormTokenizerControl()) ->setLabel('Add Reviewers') ->setName('reviewers') ->setControlID('add-reviewers') ->setControlStyle('display: none') ->setID('add-reviewers-tokenizer') ->setDisableBehavior(true)) ->appendChild( id(new AphrontFormTextAreaControl()) ->setName('comment') ->setID('comment-content') ->setLabel('Comment') ->setValue($this->draft)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue('Comment')); Javelin::initBehavior( 'differential-add-reviewers', array( 'src' => '/typeahead/common/users/', 'tokenizer' => 'add-reviewers-tokenizer', 'select' => 'comment-action', 'row' => 'add-reviewers', )); $rev_id = $revision->getID(); Javelin::initBehavior( 'differential-feedback-preview', array( 'uri' => '/differential/comment/preview/'.$rev_id.'/', 'preview' => 'comment-preview', 'action' => 'comment-action', 'content' => 'comment-content', 'inlineuri' => '/differential/comment/inline/preview/'.$rev_id.'/', 'inline' => 'inline-comment-preview', )); return '
'. '
'. '

Add Comment

'. $form->render(). '
'. '
'. '
'. ''. 'Loading comment preview...'. ''. '
'. '
'. '
'. '
'. '
'; } }