@@ -25,11 +25,7 @@ final class PHUIObjectBoxView extends AphrontTagView {
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,48 +36,8 @@ final class PHUIObjectBoxView extends AphrontTagView {
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,68 +146,6 @@ public function setValidationException(
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,19 +169,8 @@ protected function getTagAttributes() {
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,16 +276,23 @@ protected function getTagContent() {
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
}
405
294
295
+
406
296
$ content = array (
407
297
($ this ->showHideOpen == false ? $ this ->anchor : null ),
408
298
$ header ,
@@ -412,11 +302,9 @@ protected function getTagContent() {
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
);
0 commit comments