1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/view/phui/PHUIButtonBarView.php
Chad Little 6fef37ddb5 [Redesign] Update Inline Comment UI
Summary: Ref T8099, Simplifies the button bar with a `borderless` option and implements in Differential Inline Commenting.

Test Plan:
Review new and old comments, submitted, unsubmitted, ghosts, done.

{F562765}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8099

Differential Revision: https://secure.phabricator.com/D13475
2015-06-29 14:42:29 -07:00

53 lines
1.2 KiB
PHP

<?php
final class PHUIButtonBarView extends AphrontTagView {
private $buttons = array();
private $borderless;
public function addButton($button) {
$this->buttons[] = $button;
return $this;
}
public function setBorderless($borderless) {
$this->borderless = $borderless;
return $this;
}
protected function getTagAttributes() {
$classes = array();
$classes[] = 'phui-button-bar';
if ($this->borderless) {
$classes[] = 'phui-button-bar-borderless';
}
return array('class' => implode(' ', $classes));
}
protected function getTagName() {
return 'span';
}
protected function getTagContent() {
require_celerity_resource('phui-button-css');
$i = 1;
$j = count($this->buttons);
foreach ($this->buttons as $button) {
// LeeLoo Dallas Multi-Pass
if ($j > 1) {
if ($i == 1) {
$button->addClass('phui-button-bar-first');
} else if ($i == $j) {
$button->addClass('phui-button-bar-last');
} else if ($j > 1) {
$button->addClass('phui-button-bar-middle');
}
}
$this->appendChild($button);
$i++;
}
return $this->renderChildren();
}
}