1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 02:42:40 +01:00
phorge-phorge/webroot/rsrc/js/phui/behavior-phui-tab-group.js
epriestley 2c43d055b1 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
2016-06-30 18:50:25 -07:00

39 lines
894 B
JavaScript

/**
* @provides javelin-behavior-phui-tab-group
* @requires javelin-behavior
* javelin-stratcom
* javelin-dom
*/
JX.behavior('phui-tab-group', function() {
JX.Stratcom.listen(
'click',
'phui-tab-view',
function (e) {
e.kill();
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],
'phui-list-item-selected',
(tabs[ii] == tab));
}
for (var k in map) {
if (k == key) {
JX.DOM.show(JX.$(map[k]));
} else {
JX.DOM.hide(JX.$(map[k]));
}
}
});
});