protected function buildActionView(DiffusionRequest $drequest) { $viewer = $this->getRequest()->getUser(); $view = id(new PhabricatorActionListView())->setUser($viewer); $history_uri = $drequest->generateURI(array('action' => 'history')); $view->addAction(id(new PhabricatorActionView())->setName(pht('View History'))->setHref($history_uri)->setIcon('fa-list')); $behind_head = $drequest->getSymbolicCommit(); $head_uri = $drequest->generateURI(array('commit' => '', 'action' => 'browse')); $view->addAction(id(new PhabricatorActionView())->setName(pht('Jump to HEAD'))->setHref($head_uri)->setIcon('fa-home')->setDisabled(!$behind_head)); // TODO: Ideally, this should live in Owners and be event-triggered, but // there's no reasonable object for it to react to right now. $owners = 'PhabricatorOwnersApplication'; if (PhabricatorApplication::isClassInstalled($owners)) { $owners_uri = id(new PhutilURI('/owners/view/search/'))->setQueryParams(array('repository' => $drequest->getCallsign(), 'path' => '/' . $drequest->getPath())); $view->addAction(id(new PhabricatorActionView())->setName(pht('Find Owners'))->setHref((string) $owners_uri)->setIcon('fa-users')); } return $view; }
private static function renderBrowse(DiffusionRequest $drequest, $path, $name = null, $rev = null, $line = null, $view = null, $title = null) { $callsign = $drequest->getCallsign(); if ($name === null) { $name = $path; } $at = null; if ($rev) { $at = ';' . $rev; } if ($view) { $view = '?view=' . $view; } if ($line) { $line = '$' . $line; } return phutil_render_tag('a', array('href' => "/diffusion/{$callsign}/browse/{$path}{$at}{$line}{$view}", 'title' => $title), $name); }