mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 03:12:41 +01:00
9e8387175e
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
93 lines
1.8 KiB
PHP
93 lines
1.8 KiB
PHP
<?php
|
|
|
|
final class PhabricatorCrumbView extends AphrontView {
|
|
|
|
private $name;
|
|
private $href;
|
|
private $icon;
|
|
private $isLastCrumb;
|
|
private $rawName;
|
|
|
|
/**
|
|
* Allows for custom HTML inside the name field.
|
|
*
|
|
* NOTE: you must handle escaping user text if you use this method.
|
|
*/
|
|
public function setRawName($raw_name) {
|
|
$this->rawName = $raw_name;
|
|
return $this;
|
|
}
|
|
|
|
public function setName($name) {
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
public function getNameForRender() {
|
|
return nonempty($this->rawName, phutil_escape_html($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(
|
|
'phabricator-crumb-view',
|
|
);
|
|
|
|
$icon = null;
|
|
if ($this->icon) {
|
|
$classes[] = 'phabricator-crumb-has-icon';
|
|
$icon = phutil_render_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'phabricator-crumb-icon '.
|
|
'sprite-apps-large app-'.$this->icon.'-dark-large',
|
|
),
|
|
'');
|
|
}
|
|
|
|
$name = phutil_render_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'phabricator-crumb-name',
|
|
),
|
|
$this->getNameForRender());
|
|
|
|
$divider = null;
|
|
if (!$this->isLastCrumb) {
|
|
$divider = phutil_render_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'sprite-menu phabricator-crumb-divider',
|
|
),
|
|
'');
|
|
}
|
|
|
|
return phutil_render_tag(
|
|
$this->href ? 'a' : 'span',
|
|
array(
|
|
'href' => $this->href,
|
|
'class' => implode(' ', $classes),
|
|
),
|
|
$icon.$name.$divider);
|
|
}
|
|
|
|
|
|
}
|