couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject [14/50] [abbrv] couchdb commit: updated refs/heads/2041-update-ibrowse to 948e7d9
Date Fri, 07 Mar 2014 00:17:57 GMT
Fauxton: Improve spinners


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

Branch: refs/heads/2041-update-ibrowse
Commit: 46edca25a875096374097c6e01e746eaa0e5d31c
Parents: d2a0c46
Author: Garren Smith <garren.smith@gmail.com>
Authored: Tue Feb 11 10:12:21 2014 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Tue Feb 11 10:12:21 2014 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/fauxton/components.js | 22 +++++++++++++++-------
 src/fauxton/app/core/routeObject.js          |  1 -
 2 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/46edca25/src/fauxton/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/fauxton/components.js b/src/fauxton/app/addons/fauxton/components.js
index 1f5e4ad..8b21916 100644
--- a/src/fauxton/app/addons/fauxton/components.js
+++ b/src/fauxton/app/addons/fauxton/components.js
@@ -415,6 +415,8 @@ function(app, FauxtonAPI, ace, spin) {
         shadow: false // Whether to render a shadow
      };
 
+     if (routeObjectSpinner) { return; }
+
      if (!$('.spinner').length) {
        $('<div class="spinner"></div>')
         .appendTo('#app-container');
@@ -428,18 +430,22 @@ function(app, FauxtonAPI, ace, spin) {
   var removeRouteObjectSpinner = function () {
     if (routeObjectSpinner) {
       routeObjectSpinner.stop();
+      routeObjectSpinner = null;
       $('.spinner').remove();
     }
   };
 
-  var removeViewSpinner = function () {
+  var removeViewSpinner = function (selector) {
+    var viewSpinner = viewSpinners[selector];
+
     if (viewSpinner){
       viewSpinner.stop();
-      $('.spinner').remove();
+      $(selector).find('.spinner').remove();
+      delete viewSpinners[selector];
     }
   };
 
-  var viewSpinner;
+  var viewSpinners = {};
   FauxtonAPI.RouteObject.on('beforeRender', function (routeObject, view, selector) {
     removeRouteObjectSpinner();
 
@@ -455,19 +461,21 @@ function(app, FauxtonAPI, ace, spin) {
         shadow: false // Whether to render a shadow
       };
 
-      viewSpinner = new Spinner(opts).spin();
+      var viewSpinner = new Spinner(opts).spin();
       $('<div class="spinner"></div>')
         .appendTo(selector)
         .append(viewSpinner.el);
+
+      viewSpinners[selector] = viewSpinner;
     }
   });
 
   FauxtonAPI.RouteObject.on('afterRender', function (routeObject, view, selector) {
-    removeViewSpinner();
+    removeViewSpinner(selector);
   });
 
-  FauxtonAPI.RouteObject.on('viewHasRendered', function () {
-    removeViewSpinner();
+  FauxtonAPI.RouteObject.on('viewHasRendered', function (view, selector) {
+    removeViewSpinner(selector);
     removeRouteObjectSpinner();
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/46edca25/src/fauxton/app/core/routeObject.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/core/routeObject.js b/src/fauxton/app/core/routeObject.js
index 9f1067f..f8a238f 100644
--- a/src/fauxton/app/core/routeObject.js
+++ b/src/fauxton/app/core/routeObject.js
@@ -231,7 +231,6 @@ function(FauxtonAPI, Backbone) {
       if (_.isEmpty(promise)) { return; }
 
       if (!_.isArray(promise)) {
-        if (!promise.abort && !promise.reject) {
         return this._promises.push(promise);
       }
 


Mime
View raw message