Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/uiexample/examples/PHUIXComponentsExample.php b/src/applications/uiexample/examples/PHUIXComponentsExample.php
index a5c76a1e77..0b6d90f28f 100644
--- a/src/applications/uiexample/examples/PHUIXComponentsExample.php
+++ b/src/applications/uiexample/examples/PHUIXComponentsExample.php
@@ -1,122 +1,139 @@
<?php
final class PHUIXComponentsExample extends PhabricatorUIExample {
public function getName() {
return pht('PHUIX Components');
}
public function getDescription() {
return pht('Copy/paste to make design maintenance twice as difficult.');
}
public function getCategory() {
return pht('PHUIX');
}
public function renderExample() {
$content = array();
$icons = array(
array(
'icon' => 'fa-rocket',
),
array(
'icon' => 'fa-cloud',
'color' => 'indigo',
),
);
foreach ($icons as $spec) {
$icon = new PHUIIconView();
$icon->setIcon(idx($spec, 'icon'), idx($spec, 'color'));
$client_id = celerity_generate_unique_node_id();
$server_view = $icon;
$client_view = javelin_tag(
'div',
array(
'id' => $client_id,
));
Javelin::initBehavior(
'phuix-example',
array(
'type' => 'icon',
'id' => $client_id,
'spec' => $spec,
));
$content[] = id(new AphrontMultiColumnView())
->addColumn($server_view)
->addColumn($client_view);
}
$buttons = array(
array(
'text' => pht('Submit'),
),
array(
'text' => pht('Activate'),
'icon' => 'fa-rocket',
),
array(
'type' => PHUIButtonView::BUTTONTYPE_SIMPLE,
'text' => pht('3 / 5 Comments'),
'icon' => 'fa-comment',
),
array(
'color' => PHUIButtonView::GREEN,
'text' => pht('Environmental!'),
),
+ array(
+ 'icon' => 'fa-cog',
+ ),
+ array(
+ 'icon' => 'fa-cog',
+ 'type' => PHUIButtonView::BUTTONTYPE_SIMPLE,
+ ),
+ array(
+ 'text' => array('2 + 2', ' ', '=', ' ', '4'),
+ ),
+ array(
+ 'color' => PHUIButtonView::GREY,
+ 'text' => pht('Cancel'),
+ ),
+ array(
+ 'text' => array('<strong />'),
+ ),
);
foreach ($buttons as $spec) {
$button = new PHUIButtonView();
if (idx($spec, 'text') !== null) {
$button->setText($spec['text']);
}
if (idx($spec, 'icon') !== null) {
$button->setIcon($spec['icon']);
}
if (idx($spec, 'type') !== null) {
$button->setButtonType($spec['type']);
}
if (idx($spec, 'color') !== null) {
$button->setColor($spec['color']);
}
$client_id = celerity_generate_unique_node_id();
$server_view = $button;
$client_view = javelin_tag(
'div',
array(
'id' => $client_id,
));
Javelin::initBehavior(
'phuix-example',
array(
'type' => 'button',
'id' => $client_id,
'spec' => $spec,
));
$content[] = id(new AphrontMultiColumnView())
->addColumn($server_view)
->addColumn($client_view);
}
return id(new PHUIBoxView())
->appendChild($content)
->addMargin(PHUI::MARGIN_LARGE);
}
}
diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php
index fff6b089e4..2e269bd9af 100644
--- a/src/view/phui/PHUIButtonView.php
+++ b/src/view/phui/PHUIButtonView.php
@@ -1,265 +1,264 @@
<?php
final class PHUIButtonView extends AphrontTagView {
const GREEN = 'green';
const GREY = 'grey';
const DISABLED = 'disabled';
- const SIMPLE = 'simple';
const SMALL = 'small';
const BIG = 'big';
const BUTTONTYPE_DEFAULT = 'buttontype.default';
const BUTTONTYPE_SIMPLE = 'buttontype.simple';
private $size;
private $text;
private $subtext;
private $color;
private $tag = 'button';
private $dropdown;
private $icon;
private $iconFirst;
private $href = null;
private $title = null;
private $disabled;
private $name;
private $tooltip;
private $noCSS;
private $hasCaret;
private $buttonType = self::BUTTONTYPE_DEFAULT;
public function setName($name) {
$this->name = $name;
return $this;
}
public function getName() {
return $this->name;
}
public function setText($text) {
$this->text = $text;
return $this;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function setTitle($title) {
$this->title = $title;
return $this;
}
public function setSubtext($subtext) {
$this->subtext = $subtext;
return $this;
}
public function setColor($color) {
$this->color = $color;
return $this;
}
public function getColor() {
return $this->color;
}
public function setDisabled($disabled) {
$this->disabled = $disabled;
return $this;
}
public function setTag($tag) {
$this->tag = $tag;
return $this;
}
public function setSize($size) {
$this->size = $size;
return $this;
}
public function setDropdown($dd) {
$this->dropdown = $dd;
return $this;
}
public function setTooltip($text) {
$this->tooltip = $text;
return $this;
}
public function setNoCSS($no_css) {
$this->noCSS = $no_css;
return $this;
}
public function setHasCaret($has_caret) {
$this->hasCaret = $has_caret;
return $this;
}
public function getHasCaret() {
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())
->setIcon($icon);
}
$this->icon = $icon;
$this->iconFirst = $first;
return $this;
}
protected function getTagName() {
return $this->tag;
}
public function setDropdownMenu(PhabricatorActionListView $actions) {
Javelin::initBehavior('phui-dropdown-menu');
$this->addSigil('phui-dropdown-menu');
$this->setMetadata($actions->getDropdownMenuMetadata());
return $this;
}
public function setDropdownMenuID($id) {
Javelin::initBehavior('phui-dropdown-menu');
$this->addSigil('phui-dropdown-menu');
$this->setMetadata(
array(
'menuID' => $id,
));
return $this;
}
protected function getTagAttributes() {
require_celerity_resource('phui-button-css');
require_celerity_resource('phui-button-simple-css');
$classes = array();
$classes[] = 'button';
if ($this->color) {
$classes[] = $this->color;
}
if ($this->size) {
$classes[] = $this->size;
}
if ($this->dropdown) {
$classes[] = 'dropdown';
}
if ($this->icon) {
$classes[] = 'has-icon';
}
- if (strlen($this->text)) {
+ if ($this->text !== null) {
$classes[] = 'has-text';
}
if ($this->iconFirst == false) {
$classes[] = 'icon-last';
}
if ($this->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;
$meta = null;
if ($this->tooltip) {
Javelin::initBehavior('phabricator-tooltips');
require_celerity_resource('aphront-tooltip-css');
$sigil = 'has-tooltip';
$meta = array(
'tip' => $this->tooltip,
);
}
if ($this->noCSS) {
$classes = array();
}
return array(
'class' => $classes,
'href' => $this->href,
'name' => $this->name,
'title' => $this->title,
'sigil' => $sigil,
'meta' => $meta,
);
}
protected function getTagContent() {
$icon = null;
$text = $this->text;
if ($this->icon) {
$icon = $this->icon;
$subtext = null;
if ($this->subtext) {
$subtext = phutil_tag(
'div',
array(
'class' => 'phui-button-subtext',
),
$this->subtext);
}
- if (strlen($this->text)) {
+ if ($this->text !== null) {
$text = phutil_tag(
'div',
array(
'class' => 'phui-button-text',
),
array(
$text,
$subtext,
));
}
}
$caret = null;
if ($this->dropdown || $this->getHasCaret()) {
$caret = phutil_tag('span', array('class' => 'caret'), '');
}
if ($this->iconFirst == true) {
return array($icon, $text, $caret);
} else {
return array($text, $icon);
}
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Apr 28, 6:27 PM (14 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
108098
Default Alt Text
(9 KB)

Event Timeline