1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 19:32:40 +01:00
phorge-phorge/src/view/phui/PHUICrumbView.php
Chad Little 64f145ef46 Redesign Crumbs
Summary: Slimmer crumbs, less complex, no sprites, less visual disruption.

Test Plan:
Test Conpherence, Objects, Application Search pages.

{F275026}

{F275027}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11486
2015-01-26 08:27:54 -08:00

104 lines
2 KiB
PHP

<?php
final class PHUICrumbView extends AphrontView {
private $name;
private $href;
private $icon;
private $isLastCrumb;
private $workflow;
private $aural;
public function setAural($aural) {
$this->aural = $aural;
return $this;
}
public function getAural() {
return $this->aural;
}
public function setWorkflow($workflow) {
$this->workflow = $workflow;
return $this;
}
public function setName($name) {
$this->name = $name;
return $this;
}
public function getName() {
return $this->name;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function setIcon($icon) {
$this->icon = $icon;
return $this;
}
protected function canAppendChild() {
return false;
}
public function setIsLastCrumb($is_last_crumb) {
$this->isLastCrumb = $is_last_crumb;
return $this;
}
public function render() {
$classes = array(
'phui-crumb-view',
);
$aural = null;
if ($this->aural !== null) {
$aural = javelin_tag(
'span',
array(
'aural' => true,
),
$this->aural);
}
$icon = null;
if ($this->icon) {
$classes[] = 'phui-crumb-has-icon';
$icon = id(new PHUIIconView())
->setIconFont($this->icon);
}
$name = phutil_tag(
'span',
array(
'class' => 'phui-crumb-name',
),
$this->name);
$divider = null;
if (!$this->isLastCrumb) {
$divider = id(new PHUIIconView())
->setIconFont('fa-angle-right')
->addClass('phui-crumb-divider')
->addClass('phui-crumb-view');
} else {
$classes[] = 'phabricator-last-crumb';
}
$tag = javelin_tag(
$this->href ? 'a' : 'span',
array(
'sigil' => $this->workflow ? 'workflow' : null,
'href' => $this->href,
'class' => implode(' ', $classes),
),
array($aural, $icon, $name));
return array($tag, $divider);
}
}