fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
documentHistory: keeping toolbar fixed at the top
[fnpeditor.git]
/
views
/
tabs
/
tabs.js
diff --git
a/views/tabs/tabs.js
b/views/tabs/tabs.js
index
f533785
..
7c94938
100644
(file)
--- a/
views/tabs/tabs.js
+++ b/
views/tabs/tabs.js
@@
-31,18
+31,24
@@
define([
if(this.options.stacked) {
\r
this.nodes.tabBar.addClass('nav-stacked nav-pills').removeClass('nav-tabs');
\r
}
\r
if(this.options.stacked) {
\r
this.nodes.tabBar.addClass('nav-stacked nav-pills').removeClass('nav-tabs');
\r
}
\r
+ if(this.options.position === 'right') {
\r
+ this.$el.addClass('tabs-right');
\r
+ this.nodes.content.addClass('tab-content');
\r
+ }
\r
return this;
\r
},
\r
\r
addTab: function(title, slug, content) {
\r
return this;
\r
},
\r
\r
addTab: function(title, slug, content) {
\r
- if(this.contents[slug])
\r
- return false;
\r
+ if(this.contents[slug]) {
\r
+ this.contents[slug].detach();
\r
+ }
\r
this.contents[slug] = content;
\r
\r
var text = (typeof title === 'string') ? title : (title.text || '');
\r
var icon = title.icon || null;
\r
\r
this.contents[slug] = content;
\r
\r
var text = (typeof title === 'string') ? title : (title.text || '');
\r
var icon = title.icon || null;
\r
\r
- this.nodes.tabBar.append(this.handleTemplate({text: text, icon: icon, slug: slug}));
\r
+ if(!this.tabExists(slug))
\r
+ this.nodes.tabBar.append(this.handleTemplate({text: text, icon: icon, slug: slug}));
\r
if(!this.selectedTab)
\r
this.selectTab(slug);
\r
},
\r
if(!this.selectedTab)
\r
this.selectTab(slug);
\r
},
\r
@@
-67,6
+73,14
@@
define([
return this.$el;
\r
},
\r
\r
return this.$el;
\r
},
\r
\r
+ getCurrentSlug: function() {
\r
+ return this.selectedTab;
\r
+ },
\r
+
\r
+ tabExists: function(slug) {
\r
+ return this.nodes.tabBar.find('a[href="#'+ slug + '"]').length > 0;
\r
+ },
\r
+
\r
/* Events */
\r
\r
_onTabTitleClicked: function(e) {
\r
/* Events */
\r
\r
_onTabTitleClicked: function(e) {
\r