mirror of
https://we.phorge.it/source/phorge.git
synced 2025-04-08 02:18:33 +02:00
Clean up some PHUI/PHUIX button behaviors
Summary: Ref T12733. Some minor issues: - The `strlen(...)` test against `$this->text` fails if a caller does something like `setText(array(...))`. This is rare, but used in `DiffusionBrowseController`, from D15487. - Add PHUIX examples for icon-only buttons. - Remove unused `SIMPLE` constant now that no callsites remain. Test Plan: - Viewed a directory in Diffusion's "Browse" view in a Git repository, no longer saw a warning / error log. - Viewed PHUIX Components UI examples. - Grepped for `::SIMPLE`. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12733 Differential Revision: https://secure.phabricator.com/D18065
This commit is contained in:
parent
b8ad999d50
commit
d42d69aef6
2 changed files with 19 additions and 3 deletions
|
@ -72,6 +72,23 @@ final class PHUIXComponentsExample extends PhabricatorUIExample {
|
||||||
'color' => PHUIButtonView::GREEN,
|
'color' => PHUIButtonView::GREEN,
|
||||||
'text' => pht('Environmental!'),
|
'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) {
|
foreach ($buttons as $spec) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ final class PHUIButtonView extends AphrontTagView {
|
||||||
const GREEN = 'green';
|
const GREEN = 'green';
|
||||||
const GREY = 'grey';
|
const GREY = 'grey';
|
||||||
const DISABLED = 'disabled';
|
const DISABLED = 'disabled';
|
||||||
const SIMPLE = 'simple';
|
|
||||||
|
|
||||||
const SMALL = 'small';
|
const SMALL = 'small';
|
||||||
const BIG = 'big';
|
const BIG = 'big';
|
||||||
|
@ -175,7 +174,7 @@ final class PHUIButtonView extends AphrontTagView {
|
||||||
$classes[] = 'has-icon';
|
$classes[] = 'has-icon';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->text)) {
|
if ($this->text !== null) {
|
||||||
$classes[] = 'has-text';
|
$classes[] = 'has-text';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +237,7 @@ final class PHUIButtonView extends AphrontTagView {
|
||||||
$this->subtext);
|
$this->subtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->text)) {
|
if ($this->text !== null) {
|
||||||
$text = phutil_tag(
|
$text = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
|
|
Loading…
Add table
Reference in a new issue