2012-12-07 22:35:17 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorCrumbView extends AphrontView {
|
|
|
|
|
|
|
|
private $name;
|
|
|
|
private $href;
|
|
|
|
private $icon;
|
|
|
|
private $isLastCrumb;
|
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
|
|
|
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;
|
|
|
|
}
|
2012-12-07 22:35:17 +01:00
|
|
|
|
|
|
|
public function setName($name) {
|
|
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
public function getNameForRender() {
|
|
|
|
return nonempty($this->rawName, phutil_escape_html($this->name));
|
|
|
|
}
|
|
|
|
|
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(
|
|
|
|
'phabricator-crumb-view',
|
|
|
|
);
|
|
|
|
|
|
|
|
$icon = null;
|
|
|
|
if ($this->icon) {
|
|
|
|
$classes[] = 'phabricator-crumb-has-icon';
|
|
|
|
$icon = phutil_render_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 22:37:28 +01:00
|
|
|
'class' => 'phabricator-crumb-icon '.
|
2012-12-07 22:37:45 +01:00
|
|
|
'sprite-apps-large app-'.$this->icon.'-dark-large',
|
2012-12-07 22:35:17 +01:00
|
|
|
),
|
|
|
|
'');
|
|
|
|
}
|
|
|
|
|
|
|
|
$name = phutil_render_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-crumb-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
|
|
|
$this->getNameForRender());
|
2012-12-07 22:35:17 +01:00
|
|
|
|
|
|
|
$divider = null;
|
|
|
|
if (!$this->isLastCrumb) {
|
|
|
|
$divider = phutil_render_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
2012-12-07 22:35:49 +01:00
|
|
|
'class' => 'sprite-menu phabricator-crumb-divider',
|
2012-12-07 22:35:17 +01:00
|
|
|
),
|
|
|
|
'');
|
|
|
|
}
|
|
|
|
|
|
|
|
return phutil_render_tag(
|
|
|
|
$this->href ? 'a' : 'span',
|
|
|
|
array(
|
|
|
|
'href' => $this->href,
|
|
|
|
'class' => implode(' ', $classes),
|
|
|
|
),
|
|
|
|
$icon.$name.$divider);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|