1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 15:30:58 +01: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:
epriestley 2017-06-02 04:02:56 -07:00
parent b8ad999d50
commit d42d69aef6
2 changed files with 19 additions and 3 deletions

View file

@ -72,6 +72,23 @@ final class PHUIXComponentsExample extends PhabricatorUIExample {
'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) {

View file

@ -5,7 +5,6 @@ final class PHUIButtonView extends AphrontTagView {
const GREEN = 'green';
const GREY = 'grey';
const DISABLED = 'disabled';
const SIMPLE = 'simple';
const SMALL = 'small';
const BIG = 'big';
@ -175,7 +174,7 @@ final class PHUIButtonView extends AphrontTagView {
$classes[] = 'has-icon';
}
if (strlen($this->text)) {
if ($this->text !== null) {
$classes[] = 'has-text';
}
@ -238,7 +237,7 @@ final class PHUIButtonView extends AphrontTagView {
$this->subtext);
}
if (strlen($this->text)) {
if ($this->text !== null) {
$text = phutil_tag(
'div',
array(