Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15482609
D16208.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D16208.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -518,9 +518,9 @@
'rsrc/js/core/phtize.js' => 'd254d646',
'rsrc/js/phui/behavior-phui-dropdown-menu.js' => '1aa4c968',
'rsrc/js/phui/behavior-phui-file-upload.js' => 'b003d4fb',
- 'rsrc/js/phui/behavior-phui-object-box-tabs.js' => '2bfa2836',
'rsrc/js/phui/behavior-phui-profile-menu.js' => '12884df9',
'rsrc/js/phui/behavior-phui-submenu.js' => 'a6f7a73b',
+ 'rsrc/js/phui/behavior-phui-tab-group.js' => '0a0b10e9',
'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8',
'rsrc/js/phuix/PHUIXActionView.js' => '8cf6d262',
'rsrc/js/phuix/PHUIXAutocomplete.js' => '9196fb06',
@@ -673,9 +673,9 @@
'javelin-behavior-phui-dropdown-menu' => '1aa4c968',
'javelin-behavior-phui-file-upload' => 'b003d4fb',
'javelin-behavior-phui-hovercards' => 'bcaccd64',
- 'javelin-behavior-phui-object-box-tabs' => '2bfa2836',
'javelin-behavior-phui-profile-menu' => '12884df9',
'javelin-behavior-phui-submenu' => 'a6f7a73b',
+ 'javelin-behavior-phui-tab-group' => '0a0b10e9',
'javelin-behavior-policy-control' => 'd0c516d5',
'javelin-behavior-policy-rule-editor' => '5e9f347c',
'javelin-behavior-project-boards' => '14a1faae',
@@ -977,6 +977,11 @@
'javelin-stratcom',
'javelin-vector',
),
+ '0a0b10e9' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ ),
'0a3f3021' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1107,11 +1112,6 @@
'javelin-install',
'javelin-util',
),
- '2bfa2836' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- ),
'2c426492' => array(
'javelin-behavior',
'javelin-dom',
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
@@ -25,11 +25,7 @@
private $showHideContent;
private $showHideOpen;
- private $tabs = array();
- private $tabMap = null;
- private $tabLists = array();
private $propertyLists = array();
- private $propertyList = null;
const COLOR_RED = 'red';
const COLOR_BLUE = 'blue';
@@ -40,48 +36,8 @@
const BLUE_PROPERTY = 'phui-box-blue-property';
const GREY = 'phui-box-grey';
- public function addPropertyList(
- PHUIPropertyListView $property_list,
- $tab = null) {
-
- if (!($tab instanceof PHUIListItemView) &&
- ($tab !== null)) {
- assert_stringlike($tab);
- $tab = id(new PHUIListItemView())->setName($tab);
- }
-
- if ($tab) {
- if ($tab->getKey()) {
- $key = $tab->getKey();
- } else {
- $key = 'tab.default.'.spl_object_hash($tab);
- $tab->setKey($key);
- }
- } else {
- $key = 'tab.default';
- }
-
- if ($tab) {
- if (empty($this->tabs[$key])) {
- $tab->addSigil('phui-object-box-tab');
- $tab->setMetadata(
- array(
- 'tabKey' => $key,
- ));
-
- if (!$tab->getHref()) {
- $tab->setHref('#');
- }
-
- if (!$tab->getType()) {
- $tab->setType(PHUIListItemView::TYPE_LINK);
- }
-
- $this->tabs[$key] = $tab;
- }
- }
-
- $this->propertyLists[$key][] = $property_list;
+ public function addPropertyList(PHUIPropertyListView $property_list) {
+ $this->propertyLists[] = $property_list;
$action_list = $property_list->getActionList();
if ($action_list) {
@@ -190,68 +146,6 @@
return $this;
}
- public function willRender() {
- $tab_lists = array();
- $property_lists = array();
- $tab_map = array();
-
- $default_key = 'tab.default';
-
- // Find the selected tab, or select the first tab if none are selected.
- if ($this->tabs) {
- $selected_tab = null;
- foreach ($this->tabs as $key => $tab) {
- if ($tab->getSelected()) {
- $selected_tab = $key;
- break;
- }
- }
- if ($selected_tab === null) {
- head($this->tabs)->setSelected(true);
- $selected_tab = head_key($this->tabs);
- }
- }
-
- foreach ($this->propertyLists as $key => $list) {
- $group = new PHUIPropertyGroupView();
- $i = 0;
- foreach ($list as $item) {
- $group->addPropertyList($item);
- if ($i > 0 || $this->tabGroups) {
- $item->addClass('phui-property-list-section-noninitial');
- }
- $i++;
- }
-
- if ($this->tabs && $key != $default_key) {
- $tab_id = celerity_generate_unique_node_id();
- $tab_map[$key] = $tab_id;
-
- if ($key === $selected_tab) {
- $style = null;
- } else {
- $style = 'display: none';
- }
-
- $tab_lists[] = phutil_tag(
- 'div',
- array(
- 'style' => $style,
- 'id' => $tab_id,
- ),
- $group);
- } else {
- if ($this->tabs) {
- $group->addClass('phui-property-group-noninitial');
- }
- $property_lists[] = $group;
- }
- $this->propertyList = $property_lists;
- $this->tabMap = $tab_map;
- $this->tabLists = $tab_lists;
- }
- }
-
protected function getTagAttributes() {
$classes = array();
$classes[] = 'phui-box';
@@ -275,19 +169,8 @@
$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,
);
}
@@ -393,16 +276,23 @@
}
}
- $tabs = null;
- if ($this->tabs) {
- $tabs = id(new PHUIListView())
- ->setType(PHUIListView::NAVBAR_LIST);
- foreach ($this->tabs as $tab) {
- $tabs->addMenuItem($tab);
+ if ($this->propertyLists) {
+ $lists = new PHUIPropertyGroupView();
+
+ $ii = 0;
+ foreach ($this->propertyLists as $list) {
+ if ($ii > 0 || $this->tabGroups) {
+ $list->addClass('phui-property-list-section-noninitial');
+ }
+
+ $lists->addPropertyList($list);
+ $ii++;
}
- Javelin::initBehavior('phui-object-box-tabs');
+ } else {
+ $lists = null;
}
+
$content = array(
($this->showHideOpen == false ? $this->anchor : null),
$header,
@@ -412,11 +302,9 @@
$exception_errors,
$this->form,
$this->tabGroups,
- $tabs,
- $this->tabLists,
$showhide,
($this->showHideOpen == true ? $this->anchor : null),
- $this->propertyList,
+ $lists,
$this->table,
$this->renderChildren(),
);
diff --git a/src/view/phui/PHUITabGroupView.php b/src/view/phui/PHUITabGroupView.php
--- a/src/view/phui/PHUITabGroupView.php
+++ b/src/view/phui/PHUITabGroupView.php
@@ -66,7 +66,7 @@
$tab_map = mpull($this->tabs, 'getContentID', 'getKey');
return array(
- 'sigil' => 'phui-object-box',
+ 'sigil' => 'phui-tab-group-view',
'meta' => array(
'tabMap' => $tab_map,
),
@@ -74,7 +74,7 @@
}
protected function getTagContent() {
- Javelin::initBehavior('phui-object-box-tabs');
+ Javelin::initBehavior('phui-tab-group');
$tabs = id(new PHUIListView())
->setType(PHUIListView::NAVBAR_LIST);
diff --git a/src/view/phui/PHUITabView.php b/src/view/phui/PHUITabView.php
--- a/src/view/phui/PHUITabView.php
+++ b/src/view/phui/PHUITabView.php
@@ -64,7 +64,7 @@
->setKey($this->getKey())
->setType(PHUIListItemView::TYPE_LINK)
->setHref('#')
- ->addSigil('phui-object-box-tab')
+ ->addSigil('phui-tab-view')
->setMetadata(
array(
'tabKey' => $this->getKey(),
diff --git a/webroot/rsrc/js/phui/behavior-phui-object-box-tabs.js b/webroot/rsrc/js/phui/behavior-phui-tab-group.js
rename from webroot/rsrc/js/phui/behavior-phui-object-box-tabs.js
rename to webroot/rsrc/js/phui/behavior-phui-tab-group.js
--- a/webroot/rsrc/js/phui/behavior-phui-object-box-tabs.js
+++ b/webroot/rsrc/js/phui/behavior-phui-tab-group.js
@@ -1,23 +1,25 @@
/**
- * @provides javelin-behavior-phui-object-box-tabs
+ * @provides javelin-behavior-phui-tab-group
* @requires javelin-behavior
* javelin-stratcom
* javelin-dom
*/
-JX.behavior('phui-object-box-tabs', function() {
+JX.behavior('phui-tab-group', function() {
JX.Stratcom.listen(
'click',
- 'phui-object-box-tab',
+ 'phui-tab-view',
function (e) {
e.kill();
- var key = e.getNodeData('phui-object-box-tab').tabKey;
- var map = e.getNodeData('phui-object-box').tabMap;
- var tab = e.getNode('phui-object-box-tab');
- var box = e.getNode('phui-object-box');
- var tabs = JX.DOM.scry(box, 'li', 'phui-object-box-tab');
+ var map = e.getNodeData('phui-tab-group-view').tabMap;
+ var key = e.getNodeData('phui-tab-view').tabKey;
+
+ var group = e.getNode('phui-tab-group-view');
+ var tab = e.getNode('phui-tab-view');
+ var tabs = JX.DOM.scry(group, 'li', 'phui-tab-view');
+
for (var ii = 0; ii < tabs.length; ii++) {
JX.DOM.alterClass(
tabs[ii],
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 10, 6:32 AM (5 d, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7245326
Default Alt Text
D16208.diff (9 KB)
Attached To
Mode
D16208: Remove old ObjectBox tab cruft
Attached
Detach File
Event Timeline
Log In to Comment