You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/08/08 15:26:16 UTC

[08/13] git commit: updated refs/heads/master to a9c390e

Fauxton
Resize animations
Missing semi colon
Fixed the naming convention so it makes more sense to what it does.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/a9c390e4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a9c390e4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a9c390e4

Branch: refs/heads/master
Commit: a9c390e43959e7dd7b5303eae8ab2f65f8a299d7
Parents: 65451cd
Author: suelockwood <de...@gmail.com>
Authored: Wed Aug 7 12:15:01 2013 -0400
Committer: Garren Smith <ga...@gmail.com>
Committed: Thu Aug 8 15:21:27 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/api.js                  |  2 +-
 src/fauxton/app/modules/fauxton/base.js | 12 ++--
 src/fauxton/app/resizeAnimation.js      | 82 ---------------------------
 src/fauxton/app/resizeColumns.js        | 84 ++++++++++++++++++++++++++++
 4 files changed, 91 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/a9c390e4/src/fauxton/app/api.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js
index b8e1449..57bbff4 100644
--- a/src/fauxton/app/api.js
+++ b/src/fauxton/app/api.js
@@ -288,7 +288,7 @@ function(app, Fauxton) {
 
          if (!$('.spinner').length) {
            $('<div class="spinner"></div>')
-            .appendTo('#app-container')
+            .appendTo('#app-container');
          }
 
          var routeObjectSpinner = new Spinner(opts).spin();

http://git-wip-us.apache.org/repos/asf/couchdb/blob/a9c390e4/src/fauxton/app/modules/fauxton/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/fauxton/base.js b/src/fauxton/app/modules/fauxton/base.js
index 4b4690f..2b82d49 100644
--- a/src/fauxton/app/modules/fauxton/base.js
+++ b/src/fauxton/app/modules/fauxton/base.js
@@ -14,15 +14,15 @@ define([
        "app",
        // Libs
        "backbone",
-       "resizeAnimation"
+       "resizeColumns"
 
 ],
 
-function(app, Backbone, ResizeAnimation) {
+function(app, Backbone, resizeColumns) {
 
 
    //resizeAnimation
-   app.ResizeAnimation = new ResizeAnimation({
+   app.resizeColumns = new resizeColumns({
         selectorElements: '#dashboard-content'
    });
 
@@ -121,7 +121,7 @@ function(app, Backbone, ResizeAnimation) {
       function toggleMenu(){
         $selectorList.toggleClass('closeMenu');
         menuOpen = $selectorList.hasClass('closeMenu');
-        app.ResizeAnimation.onResizeHandler();
+        app.resizeColumns.onResizeHandler();
       }
 
       $('#primary-navbar').on("click", ".nav a", function(){
@@ -129,13 +129,13 @@ function(app, Backbone, ResizeAnimation) {
         setTimeout(
           function(){
             $selectorList.addClass('closeMenu');
-            app.ResizeAnimation.onResizeHandler();
+            app.resizeColumns.onResizeHandler();
           },3000);
 
         }
       });
 
-      app.ResizeAnimation.initialize();
+      app.resizeColumns.initialize();
     },
 
     beforeRender: function () {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/a9c390e4/src/fauxton/app/resizeAnimation.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/resizeAnimation.js b/src/fauxton/app/resizeAnimation.js
deleted file mode 100644
index 5465a7e..0000000
--- a/src/fauxton/app/resizeAnimation.js
+++ /dev/null
@@ -1,82 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-
-// This file creates a set of helper functions that will be loaded for all html
-// templates. These functions should be self contained and not rely on any 
-// external dependencies as they are loaded prior to the application. We may
-// want to change this later, but for now this should be thought of as a
-// "purely functional" helper system.
-
-define([
-],
-
-function() {
-
-  var Resize = function(options){
-    this.options = options;
-    this.options.selectorElements = options.selectorElements || "#dashboard-content";
-  };
-
-  Resize.prototype = {
-    getPrimaryNavWidth: function(){
-      var primaryNavWidth  = $('body').hasClass('closeMenu')? 66:220;
-      return primaryNavWidth;
-    },
-    getPanelWidth: function(){
-      var sidebarWidth = $('#sidebar-content').length > 0 ? $('#sidebar-content').width(): 0;
-      return (this.getPrimaryNavWidth() + sidebarWidth); 
-    },
-    initialize: function(){
-      $(window).off('resize');
-      var that = this;
-      //add throttler :) 
-      this.lazyLayout = _.debounce(that.onResizeHandler, 300).bind(this);
-      $(window).on('resize', this.lazyLayout);
-      this.onResizeHandler();
-    },
-    updateOptions:function(options){
-      this.options = {};
-      this.options = options;
-    },
-    turnOff:function(){
-      $(window).off('resize');
-    },
-    onResizeHandler: function (){
-      //if there is an override, do that instead
-      console.log("onResizeHandler");
-      if (this.options.onResizeHandler){
-        this.options.onResizeHandler();
-      } else {
-        var combinedWidth = window.innerWidth - this.getPanelWidth(),
-        smallWidthConstraint = ($('#sidebar-content').length > 0)? 470:800,
-        panelWidth; 
-
-        if( combinedWidth > smallWidthConstraint  && combinedWidth < 1400){
-          panelWidth = window.innerWidth - this.getPanelWidth();
-        } else if (combinedWidth < smallWidthConstraint){
-          panelWidth = smallWidthConstraint;
-        } else if(combinedWidth > 1400){
-          panelWidth = 1400;
-        }
-
-        $(this.options.selectorElements).innerWidth(panelWidth);
-      }
-      //if there is a callback, run that
-      if(this.options.callback) {
-        this.options.callback();
-      }
-    } 
-  };
-
-  return Resize;
-});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/a9c390e4/src/fauxton/app/resizeColumns.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/resizeColumns.js b/src/fauxton/app/resizeColumns.js
new file mode 100644
index 0000000..d8bbacd
--- /dev/null
+++ b/src/fauxton/app/resizeColumns.js
@@ -0,0 +1,84 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+
+// This file creates a set of helper functions that will be loaded for all html
+// templates. These functions should be self contained and not rely on any 
+// external dependencies as they are loaded prior to the application. We may
+// want to change this later, but for now this should be thought of as a
+// "purely functional" helper system.
+
+define([
+  "mixins"
+],
+
+function(mixins) {
+
+  var Resize = function(options){
+    this.options = options;
+    this.options.selectorElements = options.selectorElements || "#dashboard-content";
+  };
+
+  Resize.prototype = {
+    getPrimaryNavWidth: function(){
+      var primaryNavWidth  = $('body').hasClass('closeMenu')? 66:220;
+      return primaryNavWidth;
+    },
+    getPanelWidth: function(){
+      var sidebarWidth = $('#sidebar-content').length > 0 ? $('#sidebar-content').width(): 0;
+      return (this.getPrimaryNavWidth() + sidebarWidth); 
+    },
+    initialize: function(){
+     // $(window).off('resize');
+      var that = this;
+      //add throttler :) 
+      this.lazyLayout = _.debounce(that.onResizeHandler, 300).bind(this);
+      mixins.addWindowResize(this.lazyLayout,"animation");
+      mixins.initWindowResize();
+      this.onResizeHandler();
+    },
+    updateOptions:function(options){
+      this.options = {};
+      this.options = options;
+    },
+    turnOff:function(){
+      mixins.removeWindowResize("animation");
+    },
+    onResizeHandler: function (){
+      //if there is an override, do that instead
+      console.log("onResizeHandler");
+      if (this.options.onResizeHandler){
+        this.options.onResizeHandler();
+      } else {
+        var combinedWidth = window.innerWidth - this.getPanelWidth(),
+        smallWidthConstraint = ($('#sidebar-content').length > 0)? 470:800,
+        panelWidth; 
+
+        if( combinedWidth > smallWidthConstraint  && combinedWidth < 1400){
+          panelWidth = window.innerWidth - this.getPanelWidth();
+        } else if (combinedWidth < smallWidthConstraint){
+          panelWidth = smallWidthConstraint;
+        } else if(combinedWidth > 1400){
+          panelWidth = 1400;
+        }
+
+        $(this.options.selectorElements).innerWidth(panelWidth);
+      }
+      //if there is a callback, run that
+      if(this.options.callback) {
+        this.options.callback();
+      }
+    } 
+  };
+
+  return Resize;
+});