2012-12-07 22:35:17 +01:00
|
|
|
<?php
|
|
|
|
|
2015-01-23 20:35:09 +01:00
|
|
|
final class PHUICrumbView extends AphrontView {
|
2012-12-07 22:35:17 +01:00
|
|
|
|
|
|
|
private $name;
|
|
|
|
private $href;
|
|
|
|
private $icon;
|
|
|
|
private $isLastCrumb;
|
2013-05-24 19:50:18 +02:00
|
|
|
private $workflow;
|
2014-05-01 17:55:45 +02:00
|
|
|
private $aural;
|
|
|
|
|
|
|
|
public function setAural($aural) {
|
|
|
|
$this->aural = $aural;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAural() {
|
|
|
|
return $this->aural;
|
|
|
|
}
|
2013-05-24 19:50:18 +02:00
|
|
|
|
|
|
|
public function setWorkflow($workflow) {
|
|
|
|
$this->workflow = $workflow;
|
|
|
|
return $this;
|
|
|
|
}
|
2012-12-07 22:35:17 +01:00
|
|
|
|
|
|
|
public function setName($name) {
|
|
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-01-26 02:07:07 +01:00
|
|
|
public function getName() {
|
|
|
|
return $this->name;
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-13 02:50:42 +01:00
|
|
|
}
|
|
|
|
|
2012-12-07 22:35:17 +01:00
|
|
|
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(
|
2015-01-23 20:35:09 +01:00
|
|
|
'phui-crumb-view',
|
2012-12-07 22:35:17 +01:00
|
|
|
);
|
|
|
|
|
2014-05-01 17:55:45 +02:00
|
|
|
$aural = null;
|
|
|
|
if ($this->aural !== null) {
|
|
|
|
$aural = javelin_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'aural' => true,
|
|
|
|
),
|
|
|
|
$this->aural);
|
|
|
|
}
|
|
|
|
|
2012-12-07 22:35:17 +01:00
|
|
|
$icon = null;
|
|
|
|
if ($this->icon) {
|
2015-01-23 20:35:09 +01:00
|
|
|
$classes[] = 'phui-crumb-has-icon';
|
2015-01-26 17:27:54 +01:00
|
|
|
$icon = id(new PHUIIconView())
|
|
|
|
->setIconFont($this->icon);
|
2012-12-07 22:35:17 +01:00
|
|
|
}
|
|
|
|
|
2013-01-26 02:07:07 +01:00
|
|
|
$name = phutil_tag(
|
2012-12-07 22:35:17 +01:00
|
|
|
'span',
|
|
|
|
array(
|
2015-01-23 20:35:09 +01:00
|
|
|
'class' => 'phui-crumb-name',
|
2012-12-07 22:35:17 +01:00
|
|
|
),
|
2013-01-26 02:07:07 +01:00
|
|
|
$this->name);
|
2012-12-07 22:35:17 +01:00
|
|
|
|
|
|
|
$divider = null;
|
|
|
|
if (!$this->isLastCrumb) {
|
2015-01-26 17:27:54 +01:00
|
|
|
$divider = id(new PHUIIconView())
|
|
|
|
->setIconFont('fa-angle-right')
|
|
|
|
->addClass('phui-crumb-divider')
|
|
|
|
->addClass('phui-crumb-view');
|
2013-03-26 21:15:15 +01:00
|
|
|
} else {
|
|
|
|
$classes[] = 'phabricator-last-crumb';
|
2012-12-07 22:35:17 +01:00
|
|
|
}
|
|
|
|
|
2015-01-26 17:27:54 +01:00
|
|
|
$tag = javelin_tag(
|
2012-12-07 22:35:17 +01:00
|
|
|
$this->href ? 'a' : 'span',
|
2013-05-24 19:50:18 +02:00
|
|
|
array(
|
|
|
|
'sigil' => $this->workflow ? 'workflow' : null,
|
|
|
|
'href' => $this->href,
|
|
|
|
'class' => implode(' ', $classes),
|
|
|
|
),
|
2015-01-26 17:27:54 +01:00
|
|
|
array($aural, $icon, $name));
|
|
|
|
|
|
|
|
return array($tag, $divider);
|
2012-12-07 22:35:17 +01:00
|
|
|
}
|
|
|
|
}
|