couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [02/21] git commit: updated refs/heads/1846-dev-server-improvements to 5da4bbf
Date Mon, 08 Jul 2013 15:59:55 GMT
Fauxton: Set active nav tab

When a nav tab is clicked on that tab is now highlighted.
This fixes COUCHDB-1842


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

Branch: refs/heads/1846-dev-server-improvements
Commit: bc4120a730eb18d671882a7684dd5460799139ee
Parents: f4b27ce
Author: Garren Smith <garren.smith@gmail.com>
Authored: Thu Jun 27 17:09:20 2013 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Thu Jun 27 17:09:20 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/config/base.js          | 2 +-
 src/fauxton/app/addons/config/routes.js        | 2 ++
 src/fauxton/app/addons/logs/base.js            | 2 +-
 src/fauxton/app/addons/logs/routes.js          | 2 ++
 src/fauxton/app/addons/stats/base.js           | 2 +-
 src/fauxton/app/addons/stats/routes.js         | 2 ++
 src/fauxton/app/api.js                         | 5 +++++
 src/fauxton/app/modules/databases/routes.js    | 2 ++
 src/fauxton/app/modules/fauxton/base.js        | 3 +--
 src/fauxton/app/templates/fauxton/nav_bar.html | 2 +-
 10 files changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/src/fauxton/app/addons/config/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/base.js b/src/fauxton/app/addons/config/base.js
index f589b16..6d3261c 100644
--- a/src/fauxton/app/addons/config/base.js
+++ b/src/fauxton/app/addons/config/base.js
@@ -21,7 +21,7 @@ define([
 
 function(app, FauxtonAPI, Config) {
   Config.initialize = function() {
-    FauxtonAPI.addHeaderLink({title: "Config", href: "#_config"});
+    FauxtonAPI.addHeaderLink({title: "Config", href: "#_config", id: "config"});
   };
 
   return Config;

http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/src/fauxton/app/addons/config/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/routes.js b/src/fauxton/app/addons/config/routes.js
index d86715f..3f8d7ac 100644
--- a/src/fauxton/app/addons/config/routes.js
+++ b/src/fauxton/app/addons/config/routes.js
@@ -30,6 +30,8 @@ function(app, FauxtonAPI, Config) {
 
     roles: ["_admin"],
 
+    selectedHeaderId: "config",
+
     crumbs: [
       {"name": "Config","link": "_config"}
     ],

http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/src/fauxton/app/addons/logs/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/logs/base.js b/src/fauxton/app/addons/logs/base.js
index c17e159..dfecb03 100644
--- a/src/fauxton/app/addons/logs/base.js
+++ b/src/fauxton/app/addons/logs/base.js
@@ -21,7 +21,7 @@ define([
 
 function(app, FauxtonAPI, Log) {
   Log.initialize = function() {
-    FauxtonAPI.addHeaderLink({title: "Log", href: "#_log"});
+    FauxtonAPI.addHeaderLink({title: "Log", href: "#_log", id: "log"});
   };
 
   return Log;

http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/src/fauxton/app/addons/logs/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/logs/routes.js b/src/fauxton/app/addons/logs/routes.js
index 1023ffe..0961f7b 100644
--- a/src/fauxton/app/addons/logs/routes.js
+++ b/src/fauxton/app/addons/logs/routes.js
@@ -32,6 +32,8 @@ function(app, FauxtonAPI, Log) {
       "_log": "showLog"
     },
 
+    selectedHeaderId: "log",
+
     roles: ["_admin"],
 
     apiUrl: function() {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/src/fauxton/app/addons/stats/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/stats/base.js b/src/fauxton/app/addons/stats/base.js
index 4721399..ac09437 100644
--- a/src/fauxton/app/addons/stats/base.js
+++ b/src/fauxton/app/addons/stats/base.js
@@ -19,7 +19,7 @@ define([
 function(app, FauxtonAPI, Stats) {
 
   Stats.initialize = function() {
-    FauxtonAPI.addHeaderLink({title: "Statistics", href: "#stats"});
+    FauxtonAPI.addHeaderLink({title: "Statistics", href: "#stats", id: "stats"});
   };
 
   return Stats;

http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/src/fauxton/app/addons/stats/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/stats/routes.js b/src/fauxton/app/addons/stats/routes.js
index 32017c3..994b4e2 100644
--- a/src/fauxton/app/addons/stats/routes.js
+++ b/src/fauxton/app/addons/stats/routes.js
@@ -26,6 +26,8 @@ function(app, FauxtonAPI, Stats) {
       "_stats": "showStats"
     },
 
+    selectedHeaderId: "stats",
+
     initialize: function () {
       this.stats = new Stats.Collection();
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/src/fauxton/app/api.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js
index 58c413d..b54a080 100644
--- a/src/fauxton/app/api.js
+++ b/src/fauxton/app/api.js
@@ -256,6 +256,11 @@ function(app, Fauxton) {
       // Only want to redo the template if its a full render
       if (!this.renderedState) {
         masterLayout.setTemplate(this.layout);
+          $('#nav-links li').removeClass('active');
+
+        if (this.selectedHeaderId) {
+          $('#nav-links li#' + this.selectedHeaderId).addClass('active');
+        }
       }
 
       //add page loader. "app-container" shouldn't be overwritten. Even if a new index.underscore
is provided in settings.json

http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/src/fauxton/app/modules/databases/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/routes.js b/src/fauxton/app/modules/databases/routes.js
index 5772ee8..88c939f 100644
--- a/src/fauxton/app/modules/databases/routes.js
+++ b/src/fauxton/app/modules/databases/routes.js
@@ -40,6 +40,8 @@ function(app, FauxtonAPI, Databases, Views) {
       return this.databases.url();
     },
 
+    selectedHeaderId: "database",
+
     initialize: function() {
       this.databases = new Databases.List();
       this.deferred = FauxtonAPI.Deferred();

http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/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 b69f4ae..3d7d93d 100644
--- a/src/fauxton/app/modules/fauxton/base.js
+++ b/src/fauxton/app/modules/fauxton/base.js
@@ -64,11 +64,10 @@ function(app, Backbone) {
     template: "templates/fauxton/nav_bar",
     // TODO: can we generate this list from the router?
     navLinks: [
-      {href:"#/_all_dbs", title:"Databases"}
+      {href:"#/_all_dbs", title:"Databases", id: "database"}
     ],
 
     initialize: function() {
-      this.on("link:add", this.render, this);
     },
 
     serialize: function() {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc4120a7/src/fauxton/app/templates/fauxton/nav_bar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/nav_bar.html b/src/fauxton/app/templates/fauxton/nav_bar.html
index ebe57d0..decc07a 100644
--- a/src/fauxton/app/templates/fauxton/nav_bar.html
+++ b/src/fauxton/app/templates/fauxton/nav_bar.html
@@ -25,7 +25,7 @@ the License.
         <ul id="nav-links" class="nav pull-right">
           <% _.each(navLinks, function(link) { %>
             <% if (!link.view) { %>
-              <li><a href="<%= link.href %>"><%= link.title %></a></li>
+            <li id= "<%= link.id %>" ><a href="<%= link.href %>"><%=
link.title %></a></li>
             <% } %>
           <% }); %>
         </ul>


Mime
View raw message