couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [2/3] fauxton commit: updated refs/heads/master to 3610716
Date Sat, 15 Aug 2015 17:11:52 GMT
Refactor code

 - use early returns
 - fix formatting

PR: #497
PR-URL: https://github.com/apache/couchdb-fauxton/pull/497
Reviewed-By: garren smith <garren.smith@gmail.com>


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

Branch: refs/heads/master
Commit: 665aa49c65aad6c4daed30f8d6fa5546da31ba85
Parents: 4abcbe4
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Wed Aug 12 19:35:18 2015 +0200
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Sat Aug 15 19:11:39 2015 +0200

----------------------------------------------------------------------
 app/addons/fauxton/navigation/stores.js | 17 ++++++++++++-----
 app/app.js                              |  9 ++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/665aa49c/app/addons/fauxton/navigation/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/navigation/stores.js b/app/addons/fauxton/navigation/stores.js
index a5949b7..faf6988 100644
--- a/app/addons/fauxton/navigation/stores.js
+++ b/app/addons/fauxton/navigation/stores.js
@@ -43,15 +43,22 @@ function (app, FauxtonAPI, ActionTypes) {
     addLink: function (link) {
       if (link.top && !link.bottomNav) {
         this.navLinks.unshift(link);
-      } else if (link.top && link.bottomNav) {
+        return;
+      }
+      if (link.top && link.bottomNav) {
         this.bottomNavLinks.unshift(link);
-      } else if (link.bottomNav) {
+        return;
+      }
+      if (link.bottomNav) {
         this.bottomNavLinks.push(link);
-      } else if (link.footerNav) {
+        return;
+      }
+      if (link.footerNav) {
         this.footerNavLinks.push(link);
-      } else {
-        this.navLinks.push(link);
+        return;
       }
+
+      this.navLinks.push(link);
     },
 
     removeLink: function (removeLink) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/665aa49c/app/app.js
----------------------------------------------------------------------
diff --git a/app/app.js b/app/app.js
index b48f088..88372a7 100644
--- a/app/app.js
+++ b/app/app.js
@@ -128,8 +128,8 @@ function (app, $, _, Backbone, Bootstrap, Helpers, Utils, FauxtonAPI,
Couchdb) {
     // because I don't want to require fauxton/actions in this method.
     addHeaderLink: function (link) {
       FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link
+        type: 'ADD_NAVBAR_LINK',
+        link: link
       });
     },
 
@@ -138,13 +138,12 @@ function (app, $, _, Backbone, Bootstrap, Helpers, Utils, FauxtonAPI,
Couchdb) {
         type: 'UPDATE_NAVBAR_LINK',
         link: link
       });
-
     },
 
     removeHeaderLink: function (link) {
       FauxtonAPI.dispatch({
-          type: 'REMOVE_NAVBAR_LINK',
-          link: link
+        type: 'REMOVE_NAVBAR_LINK',
+        link: link
       });
     }
   });


Mime
View raw message