notebookbar: show context tabs if needed
Change-Id: I4deb132600ef34654dba665683a248691691e03d Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
This commit is contained in:
parent
bed804309a
commit
e6850dc9f7
1 changed files with 15 additions and 2 deletions
|
@ -380,19 +380,32 @@ L.Control.Notebookbar = L.Control.extend({
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var tabs = this.getTabs();
|
var tabs = this.getTabs();
|
||||||
|
var contextTab = null;
|
||||||
|
var defaultTab = null;
|
||||||
for (var tab in tabs) {
|
for (var tab in tabs) {
|
||||||
if (tabs[tab].context) {
|
if (tabs[tab].context) {
|
||||||
|
var tabElement = $('#' + tabs[tab].name + '-tab-label');
|
||||||
|
tabElement.hide();
|
||||||
var contexts = tabs[tab].context.split('|');
|
var contexts = tabs[tab].context.split('|');
|
||||||
for (var context in contexts) {
|
for (var context in contexts) {
|
||||||
if (contexts[context] === event.context) {
|
if (contexts[context] === event.context) {
|
||||||
var tabElement = $('#' + tabs[tab].name + '-tab-label');
|
tabElement.show();
|
||||||
if (!tabElement.hasClass('selected'))
|
if (!tabElement.hasClass('selected'))
|
||||||
tabElement.click();
|
contextTab = tabElement;
|
||||||
|
} else if (contexts[context] === 'default') {
|
||||||
|
tabElement.show();
|
||||||
|
if (!tabElement.hasClass('selected'))
|
||||||
|
defaultTab = tabElement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (contextTab)
|
||||||
|
contextTab.click();
|
||||||
|
else if (defaultTab)
|
||||||
|
defaultTab.click();
|
||||||
|
|
||||||
this.lastContext = event.context;
|
this.lastContext = event.context;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue