Page MenuHomePhabricator

D18048.id43407.diff
No OneTemporary

D18048.id43407.diff

diff --git a/src/applications/auth/controller/config/PhabricatorAuthListController.php b/src/applications/auth/controller/config/PhabricatorAuthListController.php
--- a/src/applications/auth/controller/config/PhabricatorAuthListController.php
+++ b/src/applications/auth/controller/config/PhabricatorAuthListController.php
@@ -103,7 +103,7 @@
$button = id(new PHUIButtonView())
->setTag('a')
- ->setColor(PHUIButtonView::SIMPLE)
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
->setHref($this->getApplicationURI('config/new/'))
->setIcon('fa-plus')
->setDisabled(!$can_manage)
diff --git a/src/applications/guides/view/PhabricatorGuideListView.php b/src/applications/guides/view/PhabricatorGuideListView.php
--- a/src/applications/guides/view/PhabricatorGuideListView.php
+++ b/src/applications/guides/view/PhabricatorGuideListView.php
@@ -30,7 +30,7 @@
->setText(pht('Skip'))
->setTag('a')
->setHref($skip_href)
- ->setColor(PHUIButtonView::SIMPLE);
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE);
$list_item->setSideColumn($skip);
}
$list->addItem($list_item);
diff --git a/src/applications/phame/query/PhameBlogSearchEngine.php b/src/applications/phame/query/PhameBlogSearchEngine.php
--- a/src/applications/phame/query/PhameBlogSearchEngine.php
+++ b/src/applications/phame/query/PhameBlogSearchEngine.php
@@ -98,7 +98,7 @@
->setTag('a')
->setText('New Post')
->setHref($this->getApplicationURI('/post/edit/?blog='.$id))
- ->setColor(PHUIButtonView::SIMPLE);
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE);
$item->setSideColumn($button);
}
diff --git a/src/applications/uiexample/examples/PHUIBoxExample.php b/src/applications/uiexample/examples/PHUIBoxExample.php
--- a/src/applications/uiexample/examples/PHUIBoxExample.php
+++ b/src/applications/uiexample/examples/PHUIBoxExample.php
@@ -62,11 +62,11 @@
);
$button = id(new PHUIButtonView())
- ->setTag('a')
- ->setColor(PHUIButtonView::SIMPLE)
- ->setIcon('fa-heart')
- ->setText(pht('Such Wow'))
- ->addClass(PHUI::MARGIN_SMALL_RIGHT);
+ ->setTag('a')
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
+ ->setIcon('fa-heart')
+ ->setText(pht('Such Wow'))
+ ->addClass(PHUI::MARGIN_SMALL_RIGHT);
$badge1 = id(new PHUIBadgeMiniView())
->setIcon('fa-bug')
diff --git a/src/applications/uiexample/examples/PHUIButtonBarExample.php b/src/applications/uiexample/examples/PHUIButtonBarExample.php
--- a/src/applications/uiexample/examples/PHUIButtonBarExample.php
+++ b/src/applications/uiexample/examples/PHUIButtonBarExample.php
@@ -36,7 +36,7 @@
foreach ($icons as $text => $icon) {
$button = id(new PHUIButtonView())
->setTag('a')
- ->setColor(PHUIButtonView::SIMPLE)
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
->setTitle($text)
->setText($text);
@@ -47,7 +47,7 @@
foreach ($icons as $text => $icon) {
$button = id(new PHUIButtonView())
->setTag('a')
- ->setColor(PHUIButtonView::SIMPLE)
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
->setTitle($text)
->setTooltip($text)
->setIcon($icon);
diff --git a/src/applications/uiexample/examples/PHUIButtonExample.php b/src/applications/uiexample/examples/PHUIButtonExample.php
--- a/src/applications/uiexample/examples/PHUIButtonExample.php
+++ b/src/applications/uiexample/examples/PHUIButtonExample.php
@@ -129,15 +129,15 @@
'Subscribe' => 'fa-check-circle bluegrey',
'Edit' => 'fa-pencil bluegrey',
);
- $colors = array(
- PHUIButtonView::SIMPLE,
+ $designs = array(
+ PHUIButtonView::BUTTONTYPE_SIMPLE,
);
$column = array();
- foreach ($colors as $color) {
+ foreach ($designs as $design) {
foreach ($icons as $text => $icon) {
$column[] = id(new PHUIButtonView())
->setTag('a')
- ->setColor($color)
+ ->setButtonType($design)
->setIcon($icon)
->setText($text)
->addClass(PHUI::MARGIN_SMALL_RIGHT);
diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php
--- a/src/view/phui/PHUIButtonView.php
+++ b/src/view/phui/PHUIButtonView.php
@@ -10,6 +10,9 @@
const SMALL = 'small';
const BIG = 'big';
+ const BUTTONTYPE_DEFAULT = 'buttontype.default';
+ const BUTTONTYPE_SIMPLE = 'buttontype.simple';
+
private $size;
private $text;
private $subtext;
@@ -25,6 +28,7 @@
private $tooltip;
private $noCSS;
private $hasCaret;
+ private $buttonType = self::BUTTONTYPE_DEFAULT;
public function setName($name) {
$this->name = $name;
@@ -103,6 +107,15 @@
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) {
if (!($icon instanceof PHUIIconView)) {
$icon = id(new PHUIIconView())
@@ -169,6 +182,15 @@
$classes[] = 'disabled';
}
+ switch ($this->getButtonType()) {
+ case self::BUTTONTYPE_DEFAULT:
+ // Nothing special for default buttons.
+ break;
+ case self::BUTTONTYPE_SIMPLE:
+ $classes[] = 'simple';
+ break;
+ }
+
$sigil = null;
$meta = null;
if ($this->tooltip) {
diff --git a/src/view/phui/PHUIDocumentViewPro.php b/src/view/phui/PHUIDocumentViewPro.php
--- a/src/view/phui/PHUIDocumentViewPro.php
+++ b/src/view/phui/PHUIDocumentViewPro.php
@@ -79,7 +79,7 @@
$toc[] = id(new PHUIButtonView())
->setTag('a')
->setIcon('fa-align-left')
- ->setColor(PHUIButtonView::SIMPLE)
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
->addClass('phui-document-toc')
->addSigil('jx-toggle-class')
->setMetaData(array(

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 15, 4:42 AM (11 h, 56 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6711780
Default Alt Text
D18048.id43407.diff (5 KB)

Event Timeline