couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From benk...@apache.org
Subject fauxton commit: updated refs/heads/master to e229a45
Date Thu, 02 Apr 2015 18:08:33 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 2e64de7fe -> e229a45fc


Allow customization of view loading styles

By default, the core Fauxton code inserts a spinner for each view
while it's loading. This can be removed via the disableLoader param
but not customized. This PR lets you define an optional
`loaderStyles` property on your view to override the styles. The
use-case here is to provide a light-coloured loader on the dark-
background Doc Editor page.

I investigated using the new React spinner, but ran into problems
targeting views that weren't loaded yet in the page load lifecycle.
This seemed an elegant solution that tapped into what we already
had.


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

Branch: refs/heads/master
Commit: e229a45fcee9bcf1282c99b57da96550254d5d48
Parents: 2e64de7
Author: Ben Keen <ben.keen@gmail.com>
Authored: Wed Apr 1 13:33:35 2015 -0700
Committer: Ben Keen <ben.keen@gmail.com>
Committed: Thu Apr 2 11:10:50 2015 -0700

----------------------------------------------------------------------
 app/addons/documents/views-doceditor.js | 6 ++++--
 app/addons/fauxton/components.js        | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e229a45f/app/addons/documents/views-doceditor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-doceditor.js b/app/addons/documents/views-doceditor.js
index 3ac3554..0e2f4c7 100644
--- a/app/addons/documents/views-doceditor.js
+++ b/app/addons/documents/views-doceditor.js
@@ -209,8 +209,10 @@ function (app, FauxtonAPI, Components, Documents, Databases, prettify)
{
       'click a.js-back': 'onClickGoBack',
       'click .code-region': 'focusOnLastLine'
     },
-
-    disableLoader: true,
+    loaderStyles: {
+      color: '#ffffff',
+      opacity: 0.15
+    },
 
     initialize: function (options) {
       this.database = options.database;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e229a45f/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index df2a332..b2fdcaf 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -990,7 +990,7 @@ function (app, FauxtonAPI, ace, spin, ZeroClipboard) {
     removeRouteObjectSpinner();
 
     if (!view.disableLoader) {
-      var opts = {
+      var opts = _.extend({
         lines: 16, // The number of lines to draw
         length: 8, // The length of each line
         width: 4, // The line thickness
@@ -999,7 +999,7 @@ function (app, FauxtonAPI, ace, spin, ZeroClipboard) {
         speed: 1, // Rounds per second
         trail: 10, // Afterglow percentage
         shadow: false // Whether to render a shadow
-      };
+      }, view.loaderStyles);
 
       var viewSpinner = new Spinner(opts).spin();
       $('<div class="spinner"></div>')


Mime
View raw message