wip: lists + uri extensions
[fnpeditor.git] / src / editor / views / tabs / tabs.js
index b910b92..ada2dba 100644 (file)
@@ -1,9 +1,10 @@
 define([
 define([
+'libs/jquery',
 'libs/text!./templates/main.html',
 'libs/text!./templates/handle.html',
 'libs/underscore',
 'libs/backbone'
 'libs/text!./templates/main.html',
 'libs/text!./templates/handle.html',
 'libs/underscore',
 'libs/backbone'
-], function(mainTemplate, handleTemplate, _, Backbone) {
+], function($, mainTemplate, handleTemplate, _, Backbone) {
     'use strict';
     
     var View = Backbone.View.extend({
     'use strict';
     
     var View = Backbone.View.extend({
@@ -47,10 +48,12 @@ define([
             var text = (typeof title === 'string') ? title : (title.text || '');
             var icon = title.icon || null;
             
             var text = (typeof title === 'string') ? title : (title.text || '');
             var icon = title.icon || null;
             
-            if(!this.tabExists(slug))
+            if(!this.tabExists(slug)) {
                 this.nodes.tabBar.append(this.handleTemplate({text: text, icon: icon, slug: slug}));
                 this.nodes.tabBar.append(this.handleTemplate({text: text, icon: icon, slug: slug}));
-            if(!this.selectedTab)
+            }
+            if(!this.selectedTab) {
                 this.selectTab(slug);
                 this.selectTab(slug);
+            }
         },
         
         selectTab: function(slug) {
         },
         
         selectTab: function(slug) {
@@ -59,8 +62,9 @@ define([
                 
                 if(this.selectedTab) {
                     var toDetach = this.contents[this.selectedTab];
                 
                 if(this.selectedTab) {
                     var toDetach = this.contents[this.selectedTab];
-                    if(toDetach.onHide)
+                    if(toDetach.onHide) {
                         toDetach.onHide();
                         toDetach.onHide();
+                    }
                     toDetach.detach();
                 }
                 this.nodes.content.append(this.contents[slug]);
                     toDetach.detach();
                 }
                 this.nodes.content.append(this.contents[slug]);
@@ -93,8 +97,9 @@ define([
         _onTabTitleClicked: function(e) {
             e.preventDefault();
             var target = $(e.target);
         _onTabTitleClicked: function(e) {
             e.preventDefault();
             var target = $(e.target);
-            if(target.is('i'))
+            if(target.is('i')) {
                 target = target.parent();
                 target = target.parent();
+            }
             var slug = target.attr('href').substr(1);
             this.selectTab(slug);
         }
             var slug = target.attr('href').substr(1);
             this.selectTab(slug);
         }