Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/view/DiffusionView.php
Show All 14 Lines | abstract class DiffusionView extends AphrontView { | ||||
final public function linkHistory($path) { | final public function linkHistory($path) { | ||||
$href = $this->getDiffusionRequest()->generateURI( | $href = $this->getDiffusionRequest()->generateURI( | ||||
array( | array( | ||||
'action' => 'history', | 'action' => 'history', | ||||
'path' => $path, | 'path' => $path, | ||||
)); | )); | ||||
return $this->renderHistoryLink($href); | |||||
} | |||||
final public function linkBranchHistory($branch) { | |||||
$href = $this->getDiffusionRequest()->generateURI( | |||||
array( | |||||
'action' => 'history', | |||||
'branch' => $branch, | |||||
)); | |||||
return $this->renderHistoryLink($href); | |||||
} | |||||
final public function linkTagHistory($tag) { | |||||
$href = $this->getDiffusionRequest()->generateURI( | |||||
array( | |||||
'action' => 'history', | |||||
'commit' => $tag, | |||||
)); | |||||
return $this->renderHistoryLink($href); | |||||
} | |||||
private function renderHistoryLink($href) { | |||||
return javelin_tag( | return javelin_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => $href, | 'href' => $href, | ||||
'class' => 'diffusion-link-icon', | 'class' => 'diffusion-link-icon', | ||||
'sigil' => 'has-tooltip', | 'sigil' => 'has-tooltip', | ||||
'meta' => array( | 'meta' => array( | ||||
'tip' => pht('History'), | 'tip' => pht('History'), | ||||
'align' => 'E', | 'align' => 'E', | ||||
), | ), | ||||
), | ), | ||||
id(new PHUIIconView())->setIconFont('fa-list-ul blue')); | id(new PHUIIconView())->setIconFont('fa-history bluegrey')); | ||||
} | } | ||||
final public function linkBrowse($path, array $details = array()) { | final public function linkBrowse($path, array $details = array()) { | ||||
require_celerity_resource('diffusion-icons-css'); | require_celerity_resource('diffusion-icons-css'); | ||||
Javelin::initBehavior('phabricator-tooltips'); | Javelin::initBehavior('phabricator-tooltips'); | ||||
$file_type = idx($details, 'type'); | $file_type = idx($details, 'type'); | ||||
unset($details['type']); | unset($details['type']); | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | if ($email->getDisplayName() && $email->getDomainName()) { | ||||
'size' => 'auto', | 'size' => 'auto', | ||||
), | ), | ||||
), | ), | ||||
$email->getDisplayName()); | $email->getDisplayName()); | ||||
} | } | ||||
return hsprintf('%s', $name); | return hsprintf('%s', $name); | ||||
} | } | ||||
final protected function renderBuildable(HarbormasterBuildable $buildable) { | |||||
$status = $buildable->getBuildableStatus(); | |||||
$icon = HarbormasterBuildable::getBuildableStatusIcon($status); | |||||
$color = HarbormasterBuildable::getBuildableStatusColor($status); | |||||
$name = HarbormasterBuildable::getBuildableStatusName($status); | |||||
$icon_view = id(new PHUIIconView()) | |||||
->setIconFont($icon.' '.$color); | |||||
$tooltip_view = javelin_tag( | |||||
'span', | |||||
array( | |||||
'sigil' => 'has-tooltip', | |||||
'meta' => array('tip' => $name), | |||||
), | |||||
$icon_view); | |||||
Javelin::initBehavior('phabricator-tooltips'); | |||||
return phutil_tag( | |||||
'a', | |||||
array('href' => '/'.$buildable->getMonogram()), | |||||
$tooltip_view); | |||||
} | |||||
final protected function loadBuildables(array $commits) { | |||||
assert_instances_of($commits, 'PhabricatorRepositoryCommit'); | |||||
if (!$commits) { | |||||
return array(); | |||||
} | |||||
$viewer = $this->getUser(); | |||||
$harbormaster_app = 'PhabricatorHarbormasterApplication'; | |||||
$have_harbormaster = PhabricatorApplication::isClassInstalledForViewer( | |||||
$harbormaster_app, | |||||
$viewer); | |||||
if ($have_harbormaster) { | |||||
$buildables = id(new HarbormasterBuildableQuery()) | |||||
->setViewer($viewer) | |||||
->withBuildablePHIDs(mpull($commits, 'getPHID')) | |||||
->withManualBuildables(false) | |||||
->execute(); | |||||
$buildables = mpull($buildables, null, 'getBuildablePHID'); | |||||
} else { | |||||
$buildables = array(); | |||||
} | |||||
return $buildables; | |||||
} | |||||
} | } |