@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove old ObjectBox tab cruft

Summary: Ref T10628. Cleans up remaining weird, unused tab behaviors in ObjectBoxView to simplify ObjectBox.

Test Plan: Toggled tabs in Files.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10628

Differential Revision: https://secure.phabricator.com/D16208

+66 -176
+7 -7
resources/celerity/map.php
··· 518 518 'rsrc/js/core/phtize.js' => 'd254d646', 519 519 'rsrc/js/phui/behavior-phui-dropdown-menu.js' => '1aa4c968', 520 520 'rsrc/js/phui/behavior-phui-file-upload.js' => 'b003d4fb', 521 - 'rsrc/js/phui/behavior-phui-object-box-tabs.js' => '2bfa2836', 522 521 'rsrc/js/phui/behavior-phui-profile-menu.js' => '12884df9', 523 522 'rsrc/js/phui/behavior-phui-submenu.js' => 'a6f7a73b', 523 + 'rsrc/js/phui/behavior-phui-tab-group.js' => '0a0b10e9', 524 524 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 525 525 'rsrc/js/phuix/PHUIXActionView.js' => '8cf6d262', 526 526 'rsrc/js/phuix/PHUIXAutocomplete.js' => '9196fb06', ··· 673 673 'javelin-behavior-phui-dropdown-menu' => '1aa4c968', 674 674 'javelin-behavior-phui-file-upload' => 'b003d4fb', 675 675 'javelin-behavior-phui-hovercards' => 'bcaccd64', 676 - 'javelin-behavior-phui-object-box-tabs' => '2bfa2836', 677 676 'javelin-behavior-phui-profile-menu' => '12884df9', 678 677 'javelin-behavior-phui-submenu' => 'a6f7a73b', 678 + 'javelin-behavior-phui-tab-group' => '0a0b10e9', 679 679 'javelin-behavior-policy-control' => 'd0c516d5', 680 680 'javelin-behavior-policy-rule-editor' => '5e9f347c', 681 681 'javelin-behavior-project-boards' => '14a1faae', ··· 977 977 'javelin-stratcom', 978 978 'javelin-vector', 979 979 ), 980 + '0a0b10e9' => array( 981 + 'javelin-behavior', 982 + 'javelin-stratcom', 983 + 'javelin-dom', 984 + ), 980 985 '0a3f3021' => array( 981 986 'javelin-behavior', 982 987 'javelin-stratcom', ··· 1106 1111 '2b8de964' => array( 1107 1112 'javelin-install', 1108 1113 'javelin-util', 1109 - ), 1110 - '2bfa2836' => array( 1111 - 'javelin-behavior', 1112 - 'javelin-stratcom', 1113 - 'javelin-dom', 1114 1114 ), 1115 1115 '2c426492' => array( 1116 1116 'javelin-behavior',
+17 -129
src/view/phui/PHUIObjectBoxView.php
··· 25 25 private $showHideContent; 26 26 private $showHideOpen; 27 27 28 - private $tabs = array(); 29 - private $tabMap = null; 30 - private $tabLists = array(); 31 28 private $propertyLists = array(); 32 - private $propertyList = null; 33 29 34 30 const COLOR_RED = 'red'; 35 31 const COLOR_BLUE = 'blue'; ··· 40 36 const BLUE_PROPERTY = 'phui-box-blue-property'; 41 37 const GREY = 'phui-box-grey'; 42 38 43 - public function addPropertyList( 44 - PHUIPropertyListView $property_list, 45 - $tab = null) { 46 - 47 - if (!($tab instanceof PHUIListItemView) && 48 - ($tab !== null)) { 49 - assert_stringlike($tab); 50 - $tab = id(new PHUIListItemView())->setName($tab); 51 - } 52 - 53 - if ($tab) { 54 - if ($tab->getKey()) { 55 - $key = $tab->getKey(); 56 - } else { 57 - $key = 'tab.default.'.spl_object_hash($tab); 58 - $tab->setKey($key); 59 - } 60 - } else { 61 - $key = 'tab.default'; 62 - } 63 - 64 - if ($tab) { 65 - if (empty($this->tabs[$key])) { 66 - $tab->addSigil('phui-object-box-tab'); 67 - $tab->setMetadata( 68 - array( 69 - 'tabKey' => $key, 70 - )); 71 - 72 - if (!$tab->getHref()) { 73 - $tab->setHref('#'); 74 - } 75 - 76 - if (!$tab->getType()) { 77 - $tab->setType(PHUIListItemView::TYPE_LINK); 78 - } 79 - 80 - $this->tabs[$key] = $tab; 81 - } 82 - } 83 - 84 - $this->propertyLists[$key][] = $property_list; 39 + public function addPropertyList(PHUIPropertyListView $property_list) { 40 + $this->propertyLists[] = $property_list; 85 41 86 42 $action_list = $property_list->getActionList(); 87 43 if ($action_list) { ··· 190 146 return $this; 191 147 } 192 148 193 - public function willRender() { 194 - $tab_lists = array(); 195 - $property_lists = array(); 196 - $tab_map = array(); 197 - 198 - $default_key = 'tab.default'; 199 - 200 - // Find the selected tab, or select the first tab if none are selected. 201 - if ($this->tabs) { 202 - $selected_tab = null; 203 - foreach ($this->tabs as $key => $tab) { 204 - if ($tab->getSelected()) { 205 - $selected_tab = $key; 206 - break; 207 - } 208 - } 209 - if ($selected_tab === null) { 210 - head($this->tabs)->setSelected(true); 211 - $selected_tab = head_key($this->tabs); 212 - } 213 - } 214 - 215 - foreach ($this->propertyLists as $key => $list) { 216 - $group = new PHUIPropertyGroupView(); 217 - $i = 0; 218 - foreach ($list as $item) { 219 - $group->addPropertyList($item); 220 - if ($i > 0 || $this->tabGroups) { 221 - $item->addClass('phui-property-list-section-noninitial'); 222 - } 223 - $i++; 224 - } 225 - 226 - if ($this->tabs && $key != $default_key) { 227 - $tab_id = celerity_generate_unique_node_id(); 228 - $tab_map[$key] = $tab_id; 229 - 230 - if ($key === $selected_tab) { 231 - $style = null; 232 - } else { 233 - $style = 'display: none'; 234 - } 235 - 236 - $tab_lists[] = phutil_tag( 237 - 'div', 238 - array( 239 - 'style' => $style, 240 - 'id' => $tab_id, 241 - ), 242 - $group); 243 - } else { 244 - if ($this->tabs) { 245 - $group->addClass('phui-property-group-noninitial'); 246 - } 247 - $property_lists[] = $group; 248 - } 249 - $this->propertyList = $property_lists; 250 - $this->tabMap = $tab_map; 251 - $this->tabLists = $tab_lists; 252 - } 253 - } 254 - 255 149 protected function getTagAttributes() { 256 150 $classes = array(); 257 151 $classes[] = 'phui-box'; ··· 275 169 $classes[] = $this->background; 276 170 } 277 171 278 - $sigil = null; 279 - $metadata = null; 280 - if ($this->tabs) { 281 - $sigil = 'phui-object-box'; 282 - $metadata = array( 283 - 'tabMap' => $this->tabMap, 284 - ); 285 - } 286 - 287 172 return array( 288 173 'class' => implode(' ', $classes), 289 - 'sigil' => $sigil, 290 - 'meta' => $metadata, 291 174 ); 292 175 } 293 176 ··· 393 276 } 394 277 } 395 278 396 - $tabs = null; 397 - if ($this->tabs) { 398 - $tabs = id(new PHUIListView()) 399 - ->setType(PHUIListView::NAVBAR_LIST); 400 - foreach ($this->tabs as $tab) { 401 - $tabs->addMenuItem($tab); 279 + if ($this->propertyLists) { 280 + $lists = new PHUIPropertyGroupView(); 281 + 282 + $ii = 0; 283 + foreach ($this->propertyLists as $list) { 284 + if ($ii > 0 || $this->tabGroups) { 285 + $list->addClass('phui-property-list-section-noninitial'); 286 + } 287 + 288 + $lists->addPropertyList($list); 289 + $ii++; 402 290 } 403 - Javelin::initBehavior('phui-object-box-tabs'); 291 + } else { 292 + $lists = null; 404 293 } 294 + 405 295 406 296 $content = array( 407 297 ($this->showHideOpen == false ? $this->anchor : null), ··· 412 302 $exception_errors, 413 303 $this->form, 414 304 $this->tabGroups, 415 - $tabs, 416 - $this->tabLists, 417 305 $showhide, 418 306 ($this->showHideOpen == true ? $this->anchor : null), 419 - $this->propertyList, 307 + $lists, 420 308 $this->table, 421 309 $this->renderChildren(), 422 310 );
+2 -2
src/view/phui/PHUITabGroupView.php
··· 66 66 $tab_map = mpull($this->tabs, 'getContentID', 'getKey'); 67 67 68 68 return array( 69 - 'sigil' => 'phui-object-box', 69 + 'sigil' => 'phui-tab-group-view', 70 70 'meta' => array( 71 71 'tabMap' => $tab_map, 72 72 ), ··· 74 74 } 75 75 76 76 protected function getTagContent() { 77 - Javelin::initBehavior('phui-object-box-tabs'); 77 + Javelin::initBehavior('phui-tab-group'); 78 78 79 79 $tabs = id(new PHUIListView()) 80 80 ->setType(PHUIListView::NAVBAR_LIST);
+1 -1
src/view/phui/PHUITabView.php
··· 64 64 ->setKey($this->getKey()) 65 65 ->setType(PHUIListItemView::TYPE_LINK) 66 66 ->setHref('#') 67 - ->addSigil('phui-object-box-tab') 67 + ->addSigil('phui-tab-view') 68 68 ->setMetadata( 69 69 array( 70 70 'tabKey' => $this->getKey(),
-37
webroot/rsrc/js/phui/behavior-phui-object-box-tabs.js
··· 1 - /** 2 - * @provides javelin-behavior-phui-object-box-tabs 3 - * @requires javelin-behavior 4 - * javelin-stratcom 5 - * javelin-dom 6 - */ 7 - 8 - JX.behavior('phui-object-box-tabs', function() { 9 - 10 - JX.Stratcom.listen( 11 - 'click', 12 - 'phui-object-box-tab', 13 - function (e) { 14 - e.kill(); 15 - var key = e.getNodeData('phui-object-box-tab').tabKey; 16 - var map = e.getNodeData('phui-object-box').tabMap; 17 - var tab = e.getNode('phui-object-box-tab'); 18 - 19 - var box = e.getNode('phui-object-box'); 20 - var tabs = JX.DOM.scry(box, 'li', 'phui-object-box-tab'); 21 - for (var ii = 0; ii < tabs.length; ii++) { 22 - JX.DOM.alterClass( 23 - tabs[ii], 24 - 'phui-list-item-selected', 25 - (tabs[ii] == tab)); 26 - } 27 - 28 - for (var k in map) { 29 - if (k == key) { 30 - JX.DOM.show(JX.$(map[k])); 31 - } else { 32 - JX.DOM.hide(JX.$(map[k])); 33 - } 34 - } 35 - }); 36 - 37 - });
+39
webroot/rsrc/js/phui/behavior-phui-tab-group.js
··· 1 + /** 2 + * @provides javelin-behavior-phui-tab-group 3 + * @requires javelin-behavior 4 + * javelin-stratcom 5 + * javelin-dom 6 + */ 7 + 8 + JX.behavior('phui-tab-group', function() { 9 + 10 + JX.Stratcom.listen( 11 + 'click', 12 + 'phui-tab-view', 13 + function (e) { 14 + e.kill(); 15 + 16 + var map = e.getNodeData('phui-tab-group-view').tabMap; 17 + var key = e.getNodeData('phui-tab-view').tabKey; 18 + 19 + var group = e.getNode('phui-tab-group-view'); 20 + var tab = e.getNode('phui-tab-view'); 21 + var tabs = JX.DOM.scry(group, 'li', 'phui-tab-view'); 22 + 23 + for (var ii = 0; ii < tabs.length; ii++) { 24 + JX.DOM.alterClass( 25 + tabs[ii], 26 + 'phui-list-item-selected', 27 + (tabs[ii] == tab)); 28 + } 29 + 30 + for (var k in map) { 31 + if (k == key) { 32 + JX.DOM.show(JX.$(map[k])); 33 + } else { 34 + JX.DOM.hide(JX.$(map[k])); 35 + } 36 + } 37 + }); 38 + 39 + });