Client views no longer referring to #kiwi directly
authorDarren <darren@Darrens-MacBook-Pro.local>
Mon, 11 Mar 2013 18:51:33 +0000 (18:51 +0000)
committerDarren <darren@Darrens-MacBook-Pro.local>
Mon, 11 Mar 2013 18:51:33 +0000 (18:51 +0000)
client/assets/dev/view.js

index 41bde15becac6b14c6b27a5779efe58125a25783..a505e4a9bcf6aa040661e513ad36abc5558e2227 100644 (file)
@@ -992,7 +992,7 @@ _kiwi.view.StatusMessage = Backbone.View.extend({
         opt.timeout = opt.timeout || 5000;\r
 \r
         this.$el.text(text).attr('class', opt.type);\r
-        this.$el.slideDown(_kiwi.app.view.doLayout);\r
+        this.$el.slideDown($.proxy(_kiwi.app.view.doLayout, this));\r
 \r
         if (opt.timeout) this.doTimeout(opt.timeout);\r
     },\r
@@ -1010,7 +1010,7 @@ _kiwi.view.StatusMessage = Backbone.View.extend({
     },\r
 \r
     hide: function () {\r
-        this.$el.slideUp(_kiwi.app.view.doLayout);\r
+        this.$el.slideUp($.proxy(_kiwi.app.view.doLayout, this));\r
     },\r
 \r
     doTimeout: function (length) {\r
@@ -1072,9 +1072,11 @@ _kiwi.view.AppToolbar = Backbone.View.extend({
 \r
 _kiwi.view.Application = Backbone.View.extend({\r
     initialize: function () {\r
-        $(window).resize(this.doLayout);\r
-        $('#toolbar').resize(this.doLayout);\r
-        $('#controlbox').resize(this.doLayout);\r
+        var that = this;\r
+\r
+        $(window).resize(function() { that.doLayout.apply(that); });\r
+        $('#toolbar').resize(function() { that.doLayout.apply(that); });\r
+        $('#controlbox').resize(function() { that.doLayout.apply(that); });\r
 \r
         // Change the theme when the config is changed\r
         _kiwi.global.settings.on('change:theme', this.updateTheme, this);\r
@@ -1149,12 +1151,12 @@ _kiwi.view.Application = Backbone.View.extend({
 \r
 \r
     doLayout: function () {\r
-        var el_kiwi = $('#kiwi');\r
-        var el_panels = $('#panels');\r
-        var el_memberlists = $('#memberlists');\r
-        var el_toolbar = $('#toolbar');\r
-        var el_controlbox = $('#controlbox');\r
-        var el_resize_handle = $('#memberlists_resize_handle');\r
+        var el_kiwi = this.$el; //$('#kiwi');\r
+        var el_panels = $('#panels', el_kiwi);\r
+        var el_memberlists = $('#memberlists', el_kiwi);\r
+        var el_toolbar = $('#toolbar', el_kiwi);\r
+        var el_controlbox = $('#controlbox', el_kiwi);\r
+        var el_resize_handle = $('#memberlists_resize_handle', el_kiwi);\r
 \r
         var css_heights = {\r
             top: el_toolbar.outerHeight(true),\r
@@ -1178,7 +1180,7 @@ _kiwi.view.Application = Backbone.View.extend({
 \r
         // If we have channel tabs on the side, adjust the height\r
         if (el_kiwi.hasClass('chanlist_treeview')) {\r
-            $('#kiwi #tabs').css(css_heights);\r
+            $('#tabs', el_kiwi).css(css_heights);\r
         }\r
 \r
         // Determine if we have a narrow window (mobile/tablet/or even small desktop window)\r
@@ -1278,8 +1280,8 @@ _kiwi.view.Application = Backbone.View.extend({
         var that = this;\r
 \r
         if (!instant) {\r
-            $('#toolbar').slideUp({queue: false, duration: 400, step: this.doLayout});\r
-            $('#controlbox').slideUp({queue: false, duration: 400, step: this.doLayout});\r
+            $('#toolbar').slideUp({queue: false, duration: 400, step: $.proxy(this.doLayout, this)});\r
+            $('#controlbox').slideUp({queue: false, duration: 400, step: $.proxy(this.doLayout, this)});\r
         } else {\r
             $('#toolbar').slideUp(0);\r
             $('#controlbox').slideUp(0);\r
@@ -1291,8 +1293,8 @@ _kiwi.view.Application = Backbone.View.extend({
         var that = this;\r
 \r
         if (!instant) {\r
-            $('#toolbar').slideDown({queue: false, duration: 400, step: this.doLayout});\r
-            $('#controlbox').slideDown({queue: false, duration: 400, step: this.doLayout});\r
+            $('#toolbar').slideDown({queue: false, duration: 400, step: $.proxy(this.doLayout, this)});\r
+            $('#controlbox').slideDown({queue: false, duration: 400, step: $.proxy(this.doLayout, this)});\r
         } else {\r
             $('#toolbar').slideDown(0);\r
             $('#controlbox').slideDown(0);\r