mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-27 14:09:11 +01:00
Make "simple" a "button type", not a "color"
Summary: Ref M1476. Currently, `setColor('simple')` is meaningful. Instead, `setButtonType('simple')`. Depends on D18047. Test Plan: Looked at UI examples, Phame, Auth. Notifications mooted by D18047. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18048
This commit is contained in:
parent
83e99fb691
commit
2c0dab055f
8 changed files with 37 additions and 15 deletions
|
@ -103,7 +103,7 @@ final class PhabricatorAuthListController
|
||||||
|
|
||||||
$button = id(new PHUIButtonView())
|
$button = id(new PHUIButtonView())
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setColor(PHUIButtonView::SIMPLE)
|
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
|
||||||
->setHref($this->getApplicationURI('config/new/'))
|
->setHref($this->getApplicationURI('config/new/'))
|
||||||
->setIcon('fa-plus')
|
->setIcon('fa-plus')
|
||||||
->setDisabled(!$can_manage)
|
->setDisabled(!$can_manage)
|
||||||
|
|
|
@ -30,7 +30,7 @@ final class PhabricatorGuideListView extends AphrontView {
|
||||||
->setText(pht('Skip'))
|
->setText(pht('Skip'))
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setHref($skip_href)
|
->setHref($skip_href)
|
||||||
->setColor(PHUIButtonView::SIMPLE);
|
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE);
|
||||||
$list_item->setSideColumn($skip);
|
$list_item->setSideColumn($skip);
|
||||||
}
|
}
|
||||||
$list->addItem($list_item);
|
$list->addItem($list_item);
|
||||||
|
|
|
@ -98,7 +98,7 @@ final class PhameBlogSearchEngine
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setText('New Post')
|
->setText('New Post')
|
||||||
->setHref($this->getApplicationURI('/post/edit/?blog='.$id))
|
->setHref($this->getApplicationURI('/post/edit/?blog='.$id))
|
||||||
->setColor(PHUIButtonView::SIMPLE);
|
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE);
|
||||||
$item->setSideColumn($button);
|
$item->setSideColumn($button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,11 @@ final class PHUIBoxExample extends PhabricatorUIExample {
|
||||||
);
|
);
|
||||||
|
|
||||||
$button = id(new PHUIButtonView())
|
$button = id(new PHUIButtonView())
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setColor(PHUIButtonView::SIMPLE)
|
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
|
||||||
->setIcon('fa-heart')
|
->setIcon('fa-heart')
|
||||||
->setText(pht('Such Wow'))
|
->setText(pht('Such Wow'))
|
||||||
->addClass(PHUI::MARGIN_SMALL_RIGHT);
|
->addClass(PHUI::MARGIN_SMALL_RIGHT);
|
||||||
|
|
||||||
$badge1 = id(new PHUIBadgeMiniView())
|
$badge1 = id(new PHUIBadgeMiniView())
|
||||||
->setIcon('fa-bug')
|
->setIcon('fa-bug')
|
||||||
|
|
|
@ -36,7 +36,7 @@ final class PHUIButtonBarExample extends PhabricatorUIExample {
|
||||||
foreach ($icons as $text => $icon) {
|
foreach ($icons as $text => $icon) {
|
||||||
$button = id(new PHUIButtonView())
|
$button = id(new PHUIButtonView())
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setColor(PHUIButtonView::SIMPLE)
|
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
|
||||||
->setTitle($text)
|
->setTitle($text)
|
||||||
->setText($text);
|
->setText($text);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ final class PHUIButtonBarExample extends PhabricatorUIExample {
|
||||||
foreach ($icons as $text => $icon) {
|
foreach ($icons as $text => $icon) {
|
||||||
$button = id(new PHUIButtonView())
|
$button = id(new PHUIButtonView())
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setColor(PHUIButtonView::SIMPLE)
|
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
|
||||||
->setTitle($text)
|
->setTitle($text)
|
||||||
->setTooltip($text)
|
->setTooltip($text)
|
||||||
->setIcon($icon);
|
->setIcon($icon);
|
||||||
|
|
|
@ -129,15 +129,15 @@ final class PHUIButtonExample extends PhabricatorUIExample {
|
||||||
'Subscribe' => 'fa-check-circle bluegrey',
|
'Subscribe' => 'fa-check-circle bluegrey',
|
||||||
'Edit' => 'fa-pencil bluegrey',
|
'Edit' => 'fa-pencil bluegrey',
|
||||||
);
|
);
|
||||||
$colors = array(
|
$designs = array(
|
||||||
PHUIButtonView::SIMPLE,
|
PHUIButtonView::BUTTONTYPE_SIMPLE,
|
||||||
);
|
);
|
||||||
$column = array();
|
$column = array();
|
||||||
foreach ($colors as $color) {
|
foreach ($designs as $design) {
|
||||||
foreach ($icons as $text => $icon) {
|
foreach ($icons as $text => $icon) {
|
||||||
$column[] = id(new PHUIButtonView())
|
$column[] = id(new PHUIButtonView())
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setColor($color)
|
->setButtonType($design)
|
||||||
->setIcon($icon)
|
->setIcon($icon)
|
||||||
->setText($text)
|
->setText($text)
|
||||||
->addClass(PHUI::MARGIN_SMALL_RIGHT);
|
->addClass(PHUI::MARGIN_SMALL_RIGHT);
|
||||||
|
|
|
@ -10,6 +10,9 @@ final class PHUIButtonView extends AphrontTagView {
|
||||||
const SMALL = 'small';
|
const SMALL = 'small';
|
||||||
const BIG = 'big';
|
const BIG = 'big';
|
||||||
|
|
||||||
|
const BUTTONTYPE_DEFAULT = 'buttontype.default';
|
||||||
|
const BUTTONTYPE_SIMPLE = 'buttontype.simple';
|
||||||
|
|
||||||
private $size;
|
private $size;
|
||||||
private $text;
|
private $text;
|
||||||
private $subtext;
|
private $subtext;
|
||||||
|
@ -25,6 +28,7 @@ final class PHUIButtonView extends AphrontTagView {
|
||||||
private $tooltip;
|
private $tooltip;
|
||||||
private $noCSS;
|
private $noCSS;
|
||||||
private $hasCaret;
|
private $hasCaret;
|
||||||
|
private $buttonType = self::BUTTONTYPE_DEFAULT;
|
||||||
|
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
@ -103,6 +107,15 @@ final class PHUIButtonView extends AphrontTagView {
|
||||||
return $this->hasCaret;
|
return $this->hasCaret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setButtonType($button_type) {
|
||||||
|
$this->buttonType = $button_type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getButtonType() {
|
||||||
|
return $this->buttonType;
|
||||||
|
}
|
||||||
|
|
||||||
public function setIcon($icon, $first = true) {
|
public function setIcon($icon, $first = true) {
|
||||||
if (!($icon instanceof PHUIIconView)) {
|
if (!($icon instanceof PHUIIconView)) {
|
||||||
$icon = id(new PHUIIconView())
|
$icon = id(new PHUIIconView())
|
||||||
|
@ -169,6 +182,15 @@ final class PHUIButtonView extends AphrontTagView {
|
||||||
$classes[] = 'disabled';
|
$classes[] = 'disabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch ($this->getButtonType()) {
|
||||||
|
case self::BUTTONTYPE_DEFAULT:
|
||||||
|
// Nothing special for default buttons.
|
||||||
|
break;
|
||||||
|
case self::BUTTONTYPE_SIMPLE:
|
||||||
|
$classes[] = 'simple';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$sigil = null;
|
$sigil = null;
|
||||||
$meta = null;
|
$meta = null;
|
||||||
if ($this->tooltip) {
|
if ($this->tooltip) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ final class PHUIDocumentViewPro extends AphrontTagView {
|
||||||
$toc[] = id(new PHUIButtonView())
|
$toc[] = id(new PHUIButtonView())
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setIcon('fa-align-left')
|
->setIcon('fa-align-left')
|
||||||
->setColor(PHUIButtonView::SIMPLE)
|
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
|
||||||
->addClass('phui-document-toc')
|
->addClass('phui-document-toc')
|
||||||
->addSigil('jx-toggle-class')
|
->addSigil('jx-toggle-class')
|
||||||
->setMetaData(array(
|
->setMetaData(array(
|
||||||
|
|
Loading…
Add table
Reference in a new issue