mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-02 09:58:24 +01:00
830c2410eb
Summary: This adds a new menu item, TYPEBUTTON, for use in Conpherence and maybe others over time. Note I need to add icon support, but I'll make them later tonight. I also changed the front facing names to 'Conversations' which is way more natural. Basically, Pholio has Mocks, Differential has Diffs, Conpherence has Conversations. Test Plan: Tested Conpherence on mobile and desktop. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2430 Differential Revision: https://secure.phabricator.com/D4691
132 lines
2.4 KiB
PHP
132 lines
2.4 KiB
PHP
<?php
|
|
|
|
final class PhabricatorMenuItemView extends AphrontTagView {
|
|
|
|
const TYPE_LINK = 'type-link';
|
|
const TYPE_SPACER = 'type-spacer';
|
|
const TYPE_LABEL = 'type-label';
|
|
const TYPE_BUTTON = 'type-button';
|
|
|
|
private $name;
|
|
private $href;
|
|
private $type = self::TYPE_LINK;
|
|
private $isExternal;
|
|
private $key;
|
|
private $sortOrder = 1.0;
|
|
private $icon;
|
|
private $selected;
|
|
|
|
public function setProperty($property) {
|
|
$this->property = $property;
|
|
return $this;
|
|
}
|
|
|
|
public function getProperty() {
|
|
return $this->property;
|
|
}
|
|
|
|
public function setSelected($selected) {
|
|
$this->selected = $selected;
|
|
return $this;
|
|
}
|
|
|
|
public function getSelected() {
|
|
return $this->selected;
|
|
}
|
|
|
|
public function setIcon($icon) {
|
|
$this->icon = $icon;
|
|
return $this;
|
|
}
|
|
|
|
public function getIcon() {
|
|
return $this->icon;
|
|
}
|
|
|
|
public function setKey($key) {
|
|
$this->key = (string)$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 setSortOrder($order) {
|
|
$this->sortOrder = $order;
|
|
return $this;
|
|
}
|
|
|
|
public function getSortOrder() {
|
|
return $this->sortOrder;
|
|
}
|
|
|
|
protected function getTagName() {
|
|
return $this->href ? 'a' : 'div';
|
|
}
|
|
|
|
protected function getTagAttributes() {
|
|
return array(
|
|
'class' => array(
|
|
'phabricator-menu-item-view',
|
|
'phabricator-menu-item-'.$this->type,
|
|
),
|
|
'href' => $this->href,
|
|
);
|
|
}
|
|
|
|
protected function getTagContent() {
|
|
$name = null;
|
|
if ($this->name) {
|
|
$external = null;
|
|
if ($this->isExternal) {
|
|
$external = " \xE2\x86\x97";
|
|
}
|
|
$name = phutil_render_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'phabricator-menu-item-name',
|
|
),
|
|
phutil_escape_html($this->name.$external));
|
|
}
|
|
|
|
return $this->renderChildren().$name;
|
|
}
|
|
|
|
}
|