allow to optional prepend tabs by using prepend attribute on a tab in tabs array

This commit is contained in:
Ralf Becker 2014-03-12 17:54:52 +00:00
parent ee97185b40
commit 46d4d3acce

View File

@ -29,7 +29,7 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput],
'tabs': {
'name': 'Tabs',
'default': et2_no_init,
'description': "Array of [extra] tabs. Each tab needs {label:..., template:...}. Additional optional keys are hidden and id, for access into content array"
'description': "Array of [extra] tabs. Each tab needs {label:..., template:...}. Additional optional keys are prepend, hidden and id, for access into content array"
},
'add_tabs': {
'name': 'Add tabs',
@ -193,7 +193,7 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput],
{
tab_options.content = tab.id;
}
tabData.push({
tabData[tab.prepend ? 'unshift' : 'push'].call(tabData, {
"id": tab.id,
"label": this.egw().lang(tab.label),
"widget": null,
@ -248,6 +248,9 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput],
/**
* Load & render a tab's content
*
* @param {number} index numerical index of tab in this.tabData array
* @param {array} promises
*/
_loadTab: function(index,promises) {
var tabData = this.tabData[index];
@ -273,6 +276,8 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput],
/**
* Check for custom tabs
*
* @param {object} _attrs
*/
transformAttributes: function(_attrs) {
this._super.apply(this, arguments);