fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Visual editor: editing meta data via contenteditable instead of inputs
[fnpeditor.git]
/
modules
/
tabsManager.js
diff --git
a/modules/tabsManager.js
b/modules/tabsManager.js
index
1dd857d
..
4103887
100644
(file)
--- a/
modules/tabsManager.js
+++ b/
modules/tabsManager.js
@@
-3,7
+3,7
@@
rng.modules.tabsManager = function(sandbox) {
var $ = sandbox.$;
\r
\r
var view = $(sandbox.getTemplate('main')());
\r
var $ = sandbox.$;
\r
\r
var view = $(sandbox.getTemplate('main')());
\r
-
\r
+ var currentSlug;
\r
var tabContent = {};
\r
\r
function selectTab(slug) {
\r
var tabContent = {};
\r
\r
function selectTab(slug) {
\r
@@
-16,6
+16,8
@@
rng.modules.tabsManager = function(sandbox) {
\r
if(prevSlug == slug)
\r
return;
\r
\r
if(prevSlug == slug)
\r
return;
\r
+ if(prevSlug)
\r
+ sandbox.publish('leaving', prevSlug);
\r
\r
tabBar.find('li').removeClass('active');
\r
tabBar.find('a[href=#' + slug + ']').parent().addClass('active');
\r
\r
tabBar.find('li').removeClass('active');
\r
tabBar.find('a[href=#' + slug + ']').parent().addClass('active');
\r
@@
-23,10
+25,10
@@
rng.modules.tabsManager = function(sandbox) {
if(prevSlug)
\r
tabContent[prevSlug].detach();
\r
tabContent[slug].appendTo(view.find('#rng-tabsManager-content'));
\r
if(prevSlug)
\r
tabContent[prevSlug].detach();
\r
tabContent[slug].appendTo(view.find('#rng-tabsManager-content'));
\r
+ currentSlug = slug;
\r
}
\r
\r
\r
}
\r
\r
\r
-
\r
view.on('click', 'li a', function(e) {
\r
selectTab($(e.target).attr('href').substr(1));
\r
});
\r
view.on('click', 'li a', function(e) {
\r
selectTab($(e.target).attr('href').substr(1));
\r
});
\r
@@
-45,6
+47,9
@@
rng.modules.tabsManager = function(sandbox) {
view.find('#rng-tabsManager-tabBar').append(sandbox.getTemplate('tabHandle')({title: title, slug: slug}));
\r
if(_.values(tabContent).length === 1)
\r
selectTab(slug);
\r
view.find('#rng-tabsManager-tabBar').append(sandbox.getTemplate('tabHandle')({title: title, slug: slug}));
\r
if(_.values(tabContent).length === 1)
\r
selectTab(slug);
\r
+ },
\r
+ getCurrentSlug: function() {
\r
+ return currentSlug;
\r
}
\r
}
\r
\r
}
\r
}
\r
\r