Differential D20397 Diff 48688 webroot/rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js
Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js
| Show All 12 Lines | JX.Stratcom.listen('click', 'dashboard-tab-panel-tab', function(e) { | ||||
| // just open the menu, not select the tab. For now, pass the event here | // just open the menu, not select the tab. For now, pass the event here | ||||
| // to let the menu handler act on it. | // to let the menu handler act on it. | ||||
| if (JX.Stratcom.pass(e)) { | if (JX.Stratcom.pass(e)) { | ||||
| return; | return; | ||||
| } | } | ||||
| e.kill(); | e.kill(); | ||||
| var ii; | var selected_key = e.getNodeData('dashboard-tab-panel-tab').panelKey; | ||||
| var idx = e.getNodeData('dashboard-tab-panel-tab').idx; | |||||
| var root = e.getNode('dashboard-tab-panel-container'); | var root = e.getNode('dashboard-tab-panel-container'); | ||||
| var data = JX.Stratcom.getData(root); | var data = JX.Stratcom.getData(root); | ||||
| var ii; | |||||
| // Give the tab the user clicked a selected style, and remove it from | // Give the tab the user clicked a selected style, and remove it from | ||||
| // the other tabs. | // the other tabs. | ||||
| var tabs = JX.DOM.scry(root, 'li', 'dashboard-tab-panel-tab'); | var tabs = JX.DOM.scry(root, 'li', 'dashboard-tab-panel-tab'); | ||||
| for (ii = 0; ii < tabs.length; ii++) { | for (ii = 0; ii < tabs.length; ii++) { | ||||
| JX.DOM.alterClass(tabs[ii], 'phui-list-item-selected', (ii == idx)); | var tab = tabs[ii]; | ||||
| var tab_data = JX.Stratcom.getData(tab); | |||||
| var is_selected = (tab_data.panelKey === selected_key); | |||||
| JX.DOM.alterClass(tabs[ii], 'phui-list-item-selected', is_selected); | |||||
| } | } | ||||
| // Switch the visible content to correspond to whatever the user clicked. | // Switch the visible content to correspond to whatever the user clicked. | ||||
| for (ii = 0; ii < data.panels.length; ii++) { | for (ii = 0; ii < data.panels.length; ii++) { | ||||
| var panel = JX.$(data.panels[ii]); | var panel = data.panels[ii]; | ||||
| if (ii == idx) { | var node = JX.$(panel.panelContentID); | ||||
| JX.DOM.show(panel); | |||||
| if (panel.panelKey == selected_key) { | |||||
| JX.DOM.show(node); | |||||
| } else { | } else { | ||||
| JX.DOM.hide(panel); | JX.DOM.hide(node); | ||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||
| }); | }); | ||||