Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/uiexample/examples/PHUIButtonBarExample.php b/src/applications/uiexample/examples/PHUIButtonBarExample.php
index 0e983088c1..293cd2336a 100644
--- a/src/applications/uiexample/examples/PHUIButtonBarExample.php
+++ b/src/applications/uiexample/examples/PHUIButtonBarExample.php
@@ -1,83 +1,84 @@
<?php
final class PHUIButtonBarExample extends PhabricatorUIExample {
public function getName() {
return pht('Button Bar');
}
public function getDescription() {
return pht('A minimal UI for Buttons');
}
public function renderExample() {
$request = $this->getRequest();
$user = $request->getUser();
// Icon Buttons
$icons = array(
'Go Back' => 'fa-chevron-left bluegrey',
'Choose Date' => 'fa-calendar bluegrey',
'Edit View' => 'fa-pencil bluegrey',
'Go Forward' => 'fa-chevron-right bluegrey',
);
$button_bar1 = new PHUIButtonBarView();
foreach ($icons as $text => $icon) {
$image = id(new PHUIIconView())
->setIconFont($icon);
$button = id(new PHUIButtonView())
->setTag('a')
->setColor(PHUIButtonView::GREY)
->setTitle($text)
->setIcon($image);
$button_bar1->addButton($button);
}
$button_bar2 = new PHUIButtonBarView();
foreach ($icons as $text => $icon) {
$image = id(new PHUIIconView())
->setIconFont($icon);
$button = id(new PHUIButtonView())
->setTag('a')
->setColor(PHUIButtonView::SIMPLE)
->setTitle($text)
->setText($text);
$button_bar2->addButton($button);
}
$button_bar3 = new PHUIButtonBarView();
foreach ($icons as $text => $icon) {
$image = id(new PHUIIconView())
->setIconFont($icon);
$button = id(new PHUIButtonView())
->setTag('a')
->setColor(PHUIButtonView::SIMPLE)
->setTitle($text)
+ ->setTooltip($text)
->setIcon($image);
$button_bar3->addButton($button);
}
$layout1 = id(new PHUIBoxView())
->appendChild($button_bar1)
->addClass('ml');
$layout2 = id(new PHUIBoxView())
->appendChild($button_bar2)
->addClass('mlr mll mlb');
$layout3 = id(new PHUIBoxView())
->appendChild($button_bar3)
->addClass('mlr mll mlb');
$wrap1 = id(new PHUIObjectBoxView())
->setHeaderText('Button Bar Example')
->appendChild($layout1)
->appendChild($layout2)
->appendChild($layout3);
return array($wrap1);
}
}
diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php
index 3e0854a670..7be6fe080b 100644
--- a/src/view/phui/PHUIButtonView.php
+++ b/src/view/phui/PHUIButtonView.php
@@ -1,151 +1,178 @@
<?php
final class PHUIButtonView extends AphrontTagView {
const GREEN = 'green';
const GREY = 'grey';
const BLACK = 'black';
const DISABLED = 'disabled';
const SIMPLE = 'simple';
const SIMPLE_YELLOW = 'simple simple-yellow';
const SIMPLE_GREY = 'simple simple-grey';
const SIMPLE_BLUE = 'simple simple-blue';
const SMALL = 'small';
const BIG = 'big';
private $size;
private $text;
private $subtext;
private $color;
private $tag = 'button';
private $dropdown;
private $icon;
+ private $iconFont;
private $href = null;
private $title = null;
private $disabled;
private $name;
+ private $tooltip;
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 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 setIcon(PHUIIconView $icon) {
$this->icon = $icon;
return $this;
}
+ public function setIconFont($icon) {
+ $icon = id(new PHUIIconView())
+ ->setIconFont($icon);
+ $this->setIcon($icon);
+ return $this;
+ }
+
protected function getTagName() {
return $this->tag;
}
protected function getTagAttributes() {
require_celerity_resource('phui-button-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 ($this->disabled) {
$classes[] = 'disabled';
}
+ $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,
+ );
+ }
+
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);
}
$text = phutil_tag(
'div', array('class' => 'phui-button-text'), array($text, $subtext));
}
$caret = null;
if ($this->dropdown) {
$caret = phutil_tag('span', array('class' => 'caret'), '');
}
return array($icon, $text, $caret);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jun 10, 7:52 PM (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
140892
Default Alt Text
(6 KB)

Event Timeline