Page MenuHomePhabricator

D15291.id36889.diff
No OneTemporary

D15291.id36889.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -5711,7 +5711,7 @@
'PHUIListView' => 'AphrontTagView',
'PHUIListViewTestCase' => 'PhabricatorTestCase',
'PHUIMainMenuView' => 'AphrontView',
- 'PHUIObjectBoxView' => 'AphrontView',
+ 'PHUIObjectBoxView' => 'AphrontTagView',
'PHUIObjectItemListExample' => 'PhabricatorUIExample',
'PHUIObjectItemListView' => 'AphrontTagView',
'PHUIObjectItemView' => 'AphrontTagView',
diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php
--- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php
+++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php
@@ -174,7 +174,7 @@
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->appendChild($list)
- ->setBackground(PHUIBoxView::GREY);
+ ->setBackground(PHUIObjectBoxView::GREY);
return $box;
}
@@ -218,7 +218,7 @@
$box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Badges'))
->appendChild($flex)
- ->setBackground(PHUIBoxView::GREY);
+ ->setBackground(PHUIObjectBoxView::GREY);
return $box;
}
diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php
--- a/src/applications/project/controller/PhabricatorProjectProfileController.php
+++ b/src/applications/project/controller/PhabricatorProjectProfileController.php
@@ -59,14 +59,14 @@
->setUser($viewer)
->setProject($project)
->setLimit(5)
- ->setBackground(PHUIBoxView::GREY)
+ ->setBackground(PHUIObjectBoxView::GREY)
->setUserPHIDs($project->getMemberPHIDs());
$watcher_list = id(new PhabricatorProjectWatcherListView())
->setUser($viewer)
->setProject($project)
->setLimit(5)
- ->setBackground(PHUIBoxView::GREY)
+ ->setBackground(PHUIObjectBoxView::GREY)
->setUserPHIDs($project->getWatcherPHIDs());
$nav = $this->getProfileMenu();
@@ -244,7 +244,7 @@
return id(new PHUIObjectBoxView())
->setHeader($header)
- ->setBackground(PHUIBoxView::GREY)
+ ->setBackground(PHUIObjectBoxView::GREY)
->setObjectList($milestone_list);
}
@@ -292,7 +292,7 @@
return id(new PHUIObjectBoxView())
->setHeader($header)
- ->setBackground(PHUIBoxView::GREY)
+ ->setBackground(PHUIObjectBoxView::GREY)
->setObjectList($subproject_list);
}
diff --git a/src/view/phui/PHUIObjectBoxView.php b/src/view/phui/PHUIObjectBoxView.php
--- a/src/view/phui/PHUIObjectBoxView.php
+++ b/src/view/phui/PHUIObjectBoxView.php
@@ -1,6 +1,6 @@
<?php
-final class PHUIObjectBoxView extends AphrontView {
+final class PHUIObjectBoxView extends AphrontTagView {
private $headerText;
private $color;
@@ -12,9 +12,6 @@
private $validationException;
private $header;
private $flush;
- private $id;
- private $sigils = array();
- private $metadata;
private $actionListID;
private $objectList;
private $table;
@@ -28,6 +25,7 @@
private $showHideOpen;
private $tabs = array();
+ private $tabMap = null;
private $propertyLists = array();
const COLOR_RED = 'red';
@@ -35,15 +33,8 @@
const COLOR_GREEN = 'green';
const COLOR_YELLOW = 'yellow';
- public function addSigil($sigil) {
- $this->sigils[] = $sigil;
- return $this;
- }
-
- public function setMetadata(array $metadata) {
- $this->metadata = $metadata;
- return $this;
- }
+ const BLUE = 'phui-box-blue';
+ const GREY = 'phui-box-grey';
public function addPropertyList(
PHUIPropertyListView $property_list,
@@ -144,11 +135,6 @@
return $this;
}
- public function setID($id) {
- $this->id = $id;
- return $this;
- }
-
public function setHeader($header) {
$this->header = $header;
return $this;
@@ -195,7 +181,47 @@
return $this;
}
- public function render() {
+ protected function getTagAttributes() {
+ $classes = array();
+ $classes[] = 'phui-box';
+ $classes[] = 'phui-box-border';
+ $classes[] = 'phui-object-box';
+ $classes[] = 'mlt mll mlr';
+
+ if ($this->color) {
+ $classes[] = 'phui-object-box-'.$this->color;
+ }
+
+ if ($this->collapsed) {
+ $classes[] = 'phui-object-box-collapsed';
+ }
+
+ if ($this->flush) {
+ $classes[] = 'phui-object-box-flush';
+ }
+
+ if ($this->background) {
+ $classes[] = $this->background;
+ }
+
+ $sigil = null;
+ $metadata = null;
+ if ($this->tabs) {
+ $sigil = 'phui-object-box';
+ $metadata = array(
+ 'tabMap' => $this->tabMap,
+ );
+ }
+
+ return array(
+ 'class' => implode(' ', $classes),
+ 'sigil' => $sigil,
+ 'meta' => $metadata,
+ );
+ }
+
+ protected function getTagContent() {
+ require_celerity_resource('phui-box-css');
require_celerity_resource('phui-object-box-css');
$header = $this->header;
@@ -351,6 +377,7 @@
}
$property_lists[] = $group;
}
+ $this->tabMap = $tab_map;
}
$tabs = null;
@@ -360,69 +387,28 @@
foreach ($this->tabs as $tab) {
$tabs->addMenuItem($tab);
}
-
Javelin::initBehavior('phui-object-box-tabs');
}
- $content = id(new PHUIBoxView())
- ->appendChild(
- array(
- ($this->showHideOpen == false ? $this->anchor : null),
- $header,
- $this->infoView,
- $this->formErrors,
- $this->formSaved,
- $exception_errors,
- $this->form,
- $tabs,
- $tab_lists,
- $showhide,
- ($this->showHideOpen == true ? $this->anchor : null),
- $property_lists,
- $this->table,
- $this->renderChildren(),
- ))
- ->setBorder(true)
- ->setID($this->id)
- ->addMargin(PHUI::MARGIN_LARGE_TOP)
- ->addMargin(PHUI::MARGIN_LARGE_LEFT)
- ->addMargin(PHUI::MARGIN_LARGE_RIGHT)
- ->addClass('phui-object-box');
-
- if ($this->color) {
- $content->addClass('phui-object-box-'.$this->color);
- }
-
- if ($this->background) {
- $content->setColor($this->background);
- }
-
- if ($this->collapsed) {
- $content->addClass('phui-object-box-collapsed');
- }
-
- if ($this->tabs) {
- $content->addSigil('phui-object-box');
- $content->setMetadata(
- array(
- 'tabMap' => $tab_map,
- ));
- }
-
- if ($this->flush) {
- $content->addClass('phui-object-box-flush');
- }
-
- foreach ($this->sigils as $sigil) {
- $content->addSigil($sigil);
- }
-
- if ($this->metadata !== null) {
- $content->setMetadata($this->metadata);
- }
+ $content = array(
+ ($this->showHideOpen == false ? $this->anchor : null),
+ $header,
+ $this->infoView,
+ $this->formErrors,
+ $this->formSaved,
+ $exception_errors,
+ $this->form,
+ $tabs,
+ $tab_lists,
+ $showhide,
+ ($this->showHideOpen == true ? $this->anchor : null),
+ $property_lists,
+ $this->table,
+ $this->renderChildren(),
+ );
if ($this->objectList) {
- $content->appendChild($this->objectList);
+ $content[] = $this->objectList;
}
return $content;

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 9, 5:40 PM (2 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7390252
Default Alt Text
D15291.id36889.diff (7 KB)

Event Timeline