1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-03 19:31:02 +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', 'PhabricatorCacheTTLGarbageCollector' => 'applications/cache/garbagecollector/PhabricatorCacheTTLGarbageCollector.php',
'PhabricatorCaches' => 'applications/cache/PhabricatorCaches.php', 'PhabricatorCaches' => 'applications/cache/PhabricatorCaches.php',
'PhabricatorCalendarApplication' => 'applications/calendar/application/PhabricatorCalendarApplication.php', 'PhabricatorCalendarApplication' => 'applications/calendar/application/PhabricatorCalendarApplication.php',
'PhabricatorCalendarBrowseController' => 'applications/calendar/controller/PhabricatorCalendarBrowseController.php',
'PhabricatorCalendarController' => 'applications/calendar/controller/PhabricatorCalendarController.php', 'PhabricatorCalendarController' => 'applications/calendar/controller/PhabricatorCalendarController.php',
'PhabricatorCalendarDAO' => 'applications/calendar/storage/PhabricatorCalendarDAO.php', 'PhabricatorCalendarDAO' => 'applications/calendar/storage/PhabricatorCalendarDAO.php',
'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php', 'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php',
@ -4520,7 +4519,7 @@ phutil_register_library_map(array(
'PHUIHandleListView' => 'AphrontTagView', 'PHUIHandleListView' => 'AphrontTagView',
'PHUIHandleTagListView' => 'AphrontTagView', 'PHUIHandleTagListView' => 'AphrontTagView',
'PHUIHandleView' => 'AphrontView', 'PHUIHandleView' => 'AphrontView',
'PHUIHeaderView' => 'AphrontView', 'PHUIHeaderView' => 'AphrontTagView',
'PHUIIconExample' => 'PhabricatorUIExample', 'PHUIIconExample' => 'PhabricatorUIExample',
'PHUIIconView' => 'AphrontTagView', 'PHUIIconView' => 'AphrontTagView',
'PHUIImageMaskExample' => 'PhabricatorUIExample', 'PHUIImageMaskExample' => 'PhabricatorUIExample',
@ -4839,7 +4838,6 @@ phutil_register_library_map(array(
'PhabricatorCacheSpec' => 'Phobject', 'PhabricatorCacheSpec' => 'Phobject',
'PhabricatorCacheTTLGarbageCollector' => 'PhabricatorGarbageCollector', 'PhabricatorCacheTTLGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorCalendarApplication' => 'PhabricatorApplication', 'PhabricatorCalendarApplication' => 'PhabricatorApplication',
'PhabricatorCalendarBrowseController' => 'PhabricatorCalendarController',
'PhabricatorCalendarController' => 'PhabricatorController', 'PhabricatorCalendarController' => 'PhabricatorController',
'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO', 'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO',
'PhabricatorCalendarEvent' => array( 'PhabricatorCalendarEvent' => array(

View file

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