1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Implement PHUIHeaderView from AphrontTagView

Summary: Looking at implementing ManiphestTaskListView as standard components, need to add this functionality for Headers.

Test Plan: Browsed various pages, couldn't spot any regressions offhand.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12802
This commit is contained in:
Chad Little 2015-05-12 06:55:46 -07:00
parent 8465ef779e
commit 97fbc54d0b
2 changed files with 26 additions and 20 deletions

View file

@ -1495,7 +1495,6 @@ phutil_register_library_map(array(
'PhabricatorCacheTTLGarbageCollector' => 'applications/cache/garbagecollector/PhabricatorCacheTTLGarbageCollector.php',
'PhabricatorCaches' => 'applications/cache/PhabricatorCaches.php',
'PhabricatorCalendarApplication' => 'applications/calendar/application/PhabricatorCalendarApplication.php',
'PhabricatorCalendarBrowseController' => 'applications/calendar/controller/PhabricatorCalendarBrowseController.php',
'PhabricatorCalendarController' => 'applications/calendar/controller/PhabricatorCalendarController.php',
'PhabricatorCalendarDAO' => 'applications/calendar/storage/PhabricatorCalendarDAO.php',
'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php',
@ -4520,7 +4519,7 @@ phutil_register_library_map(array(
'PHUIHandleListView' => 'AphrontTagView',
'PHUIHandleTagListView' => 'AphrontTagView',
'PHUIHandleView' => 'AphrontView',
'PHUIHeaderView' => 'AphrontView',
'PHUIHeaderView' => 'AphrontTagView',
'PHUIIconExample' => 'PhabricatorUIExample',
'PHUIIconView' => 'AphrontTagView',
'PHUIImageMaskExample' => 'PhabricatorUIExample',
@ -4839,7 +4838,6 @@ phutil_register_library_map(array(
'PhabricatorCacheSpec' => 'Phobject',
'PhabricatorCacheTTLGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorCalendarApplication' => 'PhabricatorApplication',
'PhabricatorCalendarBrowseController' => 'PhabricatorCalendarController',
'PhabricatorCalendarController' => 'PhabricatorController',
'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO',
'PhabricatorCalendarEvent' => array(

View file

@ -1,6 +1,6 @@
<?php
final class PHUIHeaderView extends AphrontView {
final class PHUIHeaderView extends AphrontTagView {
const PROPERTY_STATUS = 1;
@ -123,7 +123,11 @@ final class PHUIHeaderView extends AphrontView {
return $this;
}
public function render() {
protected function getTagName() {
return 'div';
}
protected function getTagAttributes() {
require_celerity_resource('phui-header-view-css');
$classes = array();
@ -146,6 +150,16 @@ final class PHUIHeaderView extends AphrontView {
$classes[] = 'phui-header-tall';
}
if ($this->image) {
$classes[] = 'phui-header-has-image';
}
return array(
'class' => $classes,
);
}
protected function getTagContent() {
$image = null;
if ($this->image) {
$image = phutil_tag(
@ -156,7 +170,6 @@ final class PHUIHeaderView extends AphrontView {
'style' => 'background-image: url('.$this->image.')',
),
' ');
$classes[] = 'phui-header-has-image';
}
$header = array();
@ -243,20 +256,15 @@ final class PHUIHeaderView extends AphrontView {
$property_list);
}
return phutil_tag(
'div',
array(
'class' => implode(' ', $classes),
),
array(
$image,
phutil_tag(
'h1',
array(
'class' => 'phui-header-view grouped',
),
$header),
));
return array(
$image,
phutil_tag(
'h1',
array(
'class' => 'phui-header-view grouped',
),
$header),
);
}
private function renderPolicyProperty(PhabricatorPolicyInterface $object) {