mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
8a0fccf97a
Summary: Not for full review. This makes crumbs appear consistently in mobile. It helps give a quick link to the apps home, the page title currently on, and action icons for the object. It will take additional clean-up to make this consistent across apps. Passing for early review from a UEX perspective. I actually really like it and think onces it's everywhere, helps mobile feel complete. Test Plan: Testing in iOS and Simulator. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2796 Differential Revision: https://secure.phabricator.com/D5446
84 lines
1.6 KiB
PHP
84 lines
1.6 KiB
PHP
<?php
|
|
|
|
final class PhabricatorCrumbView extends AphrontView {
|
|
|
|
private $name;
|
|
private $href;
|
|
private $icon;
|
|
private $isLastCrumb;
|
|
|
|
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(
|
|
'phabricator-crumb-view',
|
|
);
|
|
|
|
$icon = null;
|
|
if ($this->icon) {
|
|
$classes[] = 'phabricator-crumb-has-icon';
|
|
$icon = phutil_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'phabricator-crumb-icon '.
|
|
'sprite-apps-large app-'.$this->icon.'-dark-large',
|
|
),
|
|
'');
|
|
}
|
|
|
|
$name = phutil_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'phabricator-crumb-name',
|
|
),
|
|
$this->name);
|
|
|
|
$divider = null;
|
|
if (!$this->isLastCrumb) {
|
|
$divider = phutil_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'sprite-menu phabricator-crumb-divider',
|
|
),
|
|
'');
|
|
} else {
|
|
$classes[] = 'phabricator-last-crumb';
|
|
}
|
|
|
|
return phutil_tag(
|
|
$this->href ? 'a' : 'span',
|
|
array(
|
|
'href' => $this->href,
|
|
'class' => implode(' ', $classes),
|
|
),
|
|
array($icon, $name, $divider));
|
|
}
|
|
|
|
|
|
}
|