public function render() { require_celerity_resource('differential-changeset-view-css'); $changesets = $this->changesets; if ($this->standaloneViews) { Javelin::initBehavior('differential-dropdown-menus', array()); } $output = array(); $mapping = array(); $repository = $this->repository; foreach ($changesets as $key => $changeset) { $file = $changeset->getFilename(); $class = 'differential-changeset'; if (!$this->editable) { $class .= ' differential-changeset-noneditable'; } $ref = $this->references[$key]; $detail = new DifferentialChangesetDetailView(); $detail_button = null; if ($this->standaloneViews) { $detail_uri = new PhutilURI($this->renderURI); $detail_uri->setQueryParams(array('ref' => $ref, 'whitespace' => $this->whitespace)); $diffusion_uri = null; if ($repository) { $diffusion_uri = $repository->getDiffusionBrowseURIForPath($changeset->getAbsoluteRepositoryPath($this->diff, $repository)); } $detail_button = javelin_render_tag('a', array('class' => 'button small grey', 'meta' => array('detailURI' => (string) $detail_uri, 'leftURI' => (string) $detail_uri->alter('view', 'old'), 'rightURI' => (string) $detail_uri->alter('view', 'new'), 'diffusionURI' => $diffusion_uri, 'containerID' => $detail->getID()), 'href' => $detail_uri, 'target' => '_blank', 'sigil' => 'differential-view-options'), "View Options ▼"); } $detail->setChangeset($changeset); $detail->addButton($detail_button); $detail->setSymbolIndex(idx($this->symbolIndexes, $key)); $uniq_id = celerity_generate_unique_node_id(); $detail->appendChild(phutil_render_tag('div', array('id' => $uniq_id), '<div class="differential-loading">Loading...</div>')); $output[] = $detail->render(); $mapping[$uniq_id] = $ref; } Javelin::initBehavior('differential-populate', array('registry' => $mapping, 'whitespace' => $this->whitespace, 'uri' => $this->renderURI)); Javelin::initBehavior('differential-show-more', array('uri' => $this->renderURI, 'whitespace' => $this->whitespace)); Javelin::initBehavior('differential-comment-jump', array()); if ($this->editable) { $undo_templates = $this->renderUndoTemplates(); $revision = $this->revision; Javelin::initBehavior('differential-edit-inline-comments', array('uri' => '/differential/comment/inline/edit/' . $revision->getID() . '/', 'undo_templates' => $undo_templates)); } return '<div class="differential-review-stage" id="differential-review-stage">' . implode("\n", $output) . '</div>'; }