1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-28 09:42:41 +01:00
phorge-phorge/src/view/phui/PHUIHeadThingView.php
Chad Little 8f94aa8a06 Update Diffusion UI
Summary: This updates (all?) of Diffusion/Audit to new UI, included edit and other extra form pages. It's fairly complete but I don't know all the nooks and crannies so to speak to fully verify I didn't mess anything up.

Test Plan: Tested creating new repositories, browsing, searching, auditing. Need more eyes.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15487
2016-03-17 12:05:14 -07:00

71 lines
1.3 KiB
PHP

<?php
final class PHUIHeadThingView extends AphrontTagView {
private $image;
private $imageHref;
private $content;
private $size;
const SMALL = 'head-thing-small';
const MEDIUM = 'head-thing-medium';
public function setImageHref($href) {
$this->imageHref = $href;
return $this;
}
public function setImage($image) {
$this->image = $image;
return $this;
}
public function setContent($content) {
$this->content = $content;
return $this;
}
public function setSize($size) {
$this->size = $size;
return $this;
}
protected function getTagAttributes() {
require_celerity_resource('phui-head-thing-view-css');
$classes = array();
$classes[] = 'phui-head-thing-view';
if ($this->image) {
$classes[] = 'phui-head-has-image';
}
if ($this->size) {
$classes[] = $this->size;
} else {
$classes[] = self::SMALL;
}
return array(
'class' => $classes,
);
}
protected function getTagContent() {
$image = phutil_tag(
'a',
array(
'class' => 'phui-head-thing-image',
'style' => 'background-image: url('.$this->image.');',
'href' => $this->imageHref,
));
if ($this->image) {
return array($image, $this->content);
} else {
return $this->content;
}
}
}