mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
dd94512837
Summary: - Adds `PhabricatorMenuItemView` which is a non-hacky object representing a single menu item. - Adds `PhabricatorMenuView`, a collection of items. - Deletes some busted/old interfaces full of garbage nonsense. - Merges menu item styles from `aphront-side-nav-view-css` and `phabricator-nav-view-css`. These are old-style and new-style rules which got partially updated recently. - The new-style menus have a darker background (#ececec) than the old-style menus (#f7f7f7) so some of the highlight/hover colors weren't visible. I shuffled them around but something or other might need further adjustment. Test Plan: looked at every menu I could Reviewers: chad Reviewed By: chad CC: aran Maniphest Tasks: T1960 Differential Revision: https://secure.phabricator.com/D4036
92 lines
1.7 KiB
PHP
92 lines
1.7 KiB
PHP
<?php
|
|
|
|
final class PhabricatorMenuItemView extends AphrontView {
|
|
|
|
const TYPE_LINK = 'type-link';
|
|
const TYPE_SPACER = 'type-spacer';
|
|
const TYPE_LABEL = 'type-label';
|
|
|
|
private $name;
|
|
private $href;
|
|
private $type = self::TYPE_LINK;
|
|
private $isExternal;
|
|
private $key;
|
|
private $classes = array();
|
|
|
|
public function setKey($key) {
|
|
$this->key = $key;
|
|
return $this;
|
|
}
|
|
|
|
public function getKey() {
|
|
return $this->key;
|
|
}
|
|
|
|
public function setType($type) {
|
|
$this->type = $type;
|
|
return $this;
|
|
}
|
|
|
|
public function getType() {
|
|
return $this->type;
|
|
}
|
|
|
|
public function setHref($href) {
|
|
$this->href = $href;
|
|
return $this;
|
|
}
|
|
|
|
public function getHref() {
|
|
return $this->href;
|
|
}
|
|
|
|
public function setName($name) {
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
public function getName() {
|
|
return $this->name;
|
|
}
|
|
|
|
public function setIsExternal($is_external) {
|
|
$this->isExternal = $is_external;
|
|
return $this;
|
|
}
|
|
|
|
public function getIsExternal() {
|
|
return $this->isExternal;
|
|
}
|
|
|
|
public function addClass($class) {
|
|
$this->classes[] = $class;
|
|
return $this;
|
|
}
|
|
|
|
protected function canAppendChild() {
|
|
return false;
|
|
}
|
|
|
|
public function render() {
|
|
$classes = array(
|
|
'phabricator-menu-item-view',
|
|
'phabricator-menu-item-'.$this->type,
|
|
);
|
|
|
|
$external = null;
|
|
if ($this->isExternal) {
|
|
$external = " \xE2\x86\x97";
|
|
}
|
|
|
|
$classes = array_merge($classes, $this->classes);
|
|
|
|
return phutil_render_tag(
|
|
$this->href ? 'a' : 'div',
|
|
array(
|
|
'class' => implode(' ', $classes),
|
|
'href' => $this->href,
|
|
),
|
|
phutil_escape_html($this->name.$external));
|
|
}
|
|
|
|
}
|