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/05/14 15:29:33 UTC

[3/7] git commit: updated refs/heads/route-events to 3ebf299

Route Events working with simplified API


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

Branch: refs/heads/route-events
Commit: b01651b5c81bd31d1a5c199a906274746b1ff0c3
Parents: fca3126
Author: Garren Smith <ga...@gmail.com>
Authored: Tue May 7 14:45:49 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue May 14 15:28:06 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/config/routes.js            |    6 +-
 src/fauxton/app/addons/logs/routes.js              |    8 +-
 src/fauxton/app/addons/stats/routes.js             |    8 +-
 src/fauxton/app/api.js                             |   47 ++--
 src/fauxton/app/modules/databases/routes.js        |   16 +-
 src/fauxton/app/modules/databases/views.js         |    3 +-
 src/fauxton/app/modules/documents/routes.js        |  185 +++------------
 src/fauxton/app/modules/documents/views.js         |    1 -
 src/fauxton/app/modules/fauxton/base.js            |    4 +-
 src/fauxton/app/router.js                          |   70 +-----
 .../templates/documents/doc_field_editor_tabs.html |    4 +-
 .../app/templates/documents/index_menu_item.html   |    2 +-
 src/fauxton/app/templates/documents/sidebar.html   |    6 +-
 src/fauxton/app/templates/fauxton/pagination.html  |   10 +-
 14 files changed, 96 insertions(+), 274 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/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 495e3a9..42934a8 100644
--- a/src/fauxton/app/addons/config/routes.js
+++ b/src/fauxton/app/addons/config/routes.js
@@ -36,9 +36,9 @@ function(app, FauxtonAPI, Config) {
       this.configs.url();
     },
 
-    routes: ["_config"],
-
-    defaultRoute: "config",
+    routes: {
+      "_config": "config"
+    },
 
     config: function () {
       this.setView("#dashboard-content", new Config.View({collection: this.configs}));

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/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 9bd8f65..1ce260c 100644
--- a/src/fauxton/app/addons/logs/routes.js
+++ b/src/fauxton/app/addons/logs/routes.js
@@ -28,9 +28,9 @@ function(app, FauxtonAPI, Log) {
       {"name": "Logs", "link": "_log"}
     ],
 
-    routes: ["_log"],
-
-    defaultRoute: "showLog",
+    routes: {
+      "_log": "showLog"
+    },
 
     apiUrl: function() {
       return this.logs.url();
@@ -41,7 +41,7 @@ function(app, FauxtonAPI, Log) {
       this.setView("#sidebar-content", new Log.Views.FilterView({}));
     },
 
-    showLog: function (event) {
+    showLog: function () {
       this.setView("#dashboard-content", new Log.Views.View({collection: this.logs}));
     },
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/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 7ad2a1f..32017c3 100644
--- a/src/fauxton/app/addons/stats/routes.js
+++ b/src/fauxton/app/addons/stats/routes.js
@@ -21,8 +21,10 @@ function(app, FauxtonAPI, Stats) {
   var StatsRouteObject = FauxtonAPI.RouteObject.extend({
     layout: "with_sidebar",
 
-    routes: ["stats", "_stats"],
-    defaultRoute: "showStats",
+    routes: {
+      "stats":"showStats",
+      "_stats": "showStats"
+    },
 
     initialize: function () {
       this.stats = new Stats.Collection();
@@ -33,7 +35,7 @@ function(app, FauxtonAPI, Stats) {
 
     },
 
-    showStats: function (event) {
+    showStats: function () {
       this.setView("#dashboard-content", new Views.Statistics({
         collection: this.stats
       }));

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/src/fauxton/app/api.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js
index 6591daf..1c0b8f8 100644
--- a/src/fauxton/app/api.js
+++ b/src/fauxton/app/api.js
@@ -108,25 +108,6 @@ function(app, Fauxton) {
     }
   });
 
-  // Not needed, could be removed.
-  FauxtonAPI.routeCallChain = {
-    callChain: {},
-
-    registerBeforeRoute: function (name, fn) {
-      this.callChain[name] = fn;
-    },
-
-    unregisterBeforeRoute: function (name) {
-      delete callChain[name];
-    },
-
-    run: function () {
-      var callChainDeferreds = _.map(this.callChain, function (cb) { return cb(); }); 
-      return $.when(null, callChainDeferreds );
-    }
-  };
-
-
   FauxtonAPI.RouteObject = function(options) {
     this._options = options;
 
@@ -150,7 +131,6 @@ function(app, Fauxton) {
     layout: "with_sidebar",
     apiUrl: null,
     renderedState: false,
-    currTab: "databases",
     establish: function() {},
     route: function() {},
     initialize: function() {}
@@ -161,13 +141,15 @@ function(app, Fauxton) {
     // immediately if its already done, but this way the RouteObject.route
     // function can rebuild the deferred as needed
     render: function(route, masterLayout, args) {
-      this.route.call(this, route, args);
       this.renderWith.apply(this, Array.prototype.slice.call(arguments));
     },
 
     renderWith: function(route, masterLayout, args) {
       var routeObject = this;
 
+      // Can look at replacing this with events eg beforeRender, afterRender
+      this.route.call(this, route, args);
+
       // Only want to redo the template if its a full render
       if (!this.renderedState) {
         masterLayout.setTemplate(this.layout);
@@ -184,10 +166,10 @@ function(app, Fauxton) {
 
       $.when.apply(this, this.establish()).done(function(resp) {
         _.each(routeObject.getViews(), function(view, selector) {
-          if(view.hasRendered()) { console.log('view been rendered'); return; }
+          if(view.hasRendered()) { return; }
 
           masterLayout.setView(selector, view);
-          console.log('set and render ', selector, view); 
+          console.log('SET SELECTOR AND RENDER ', selector, view); 
 
           $.when.apply(null, view.establish()).then(function(resp) {
             masterLayout.renderView(selector);
@@ -248,6 +230,25 @@ function(app, Fauxton) {
 
     getViews: function() {
       return this.views;
+    },
+
+    // Could move getRouteUrls into the Constructor function and so it defines the urls
+    // only once. This would give us a small speed up.
+    getRouteUrls: function () {
+      return _.keys(this.get('routes'));
+    },
+
+    hasRoute: function (route) {
+      if (this.getRouteUrls().indexOf(route) > -1) {
+        return true;
+      }
+
+      return false;
+    },
+
+    routeCallback: function (route) {
+      var routes = this.get('routes');
+      return this[routes[route]];
     }
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/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 f1be372..104d876 100644
--- a/src/fauxton/app/modules/databases/routes.js
+++ b/src/fauxton/app/modules/databases/routes.js
@@ -30,14 +30,12 @@ function(app, FauxtonAPI, Databases, Views) {
       {"name": "Databases", "link": "/_all_dbs"}
     ],
 
-    events: {
-      "route:all_databases": "allDatabases"
+    routes: {
+      "": "allDatabases",
+      "index.html": "allDatabases", 
+      "_all_dbs(:params)": "allDatabases"
     },
 
-    defaultRoute: "allDatabases",
-
-    routes: ["", "index.html", "_all_dbs(:params)"],
-
     apiUrl: function() {
       return this.databases.url();
     },
@@ -51,10 +49,8 @@ function(app, FauxtonAPI, Databases, Views) {
       }));
     },
 
-    allDatabases: function(event) {
-      event = event || {};
-
-      var params = app.getParams(event.attr),
+    allDatabases: function() {
+      var params = app.getParams(),
           dbPage = params.page;
 
       this.databasesView = this.setView("#dashboard-content", new Views.List({

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/src/fauxton/app/modules/databases/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/views.js b/src/fauxton/app/modules/databases/views.js
index 23145fe..c1b9bb7 100644
--- a/src/fauxton/app/modules/databases/views.js
+++ b/src/fauxton/app/modules/databases/views.js
@@ -83,8 +83,7 @@ function(app, Fauxton, FauxtonAPI) {
         total: this.collection.length,
         urlFun: function(page) {
           return "#/_all_dbs?page=" + page;
-        },
-        routeEvent: "all_databases"
+        }
       }));
     },
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/src/fauxton/app/modules/documents/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/routes.js b/src/fauxton/app/modules/documents/routes.js
index d57487f..103d904 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -45,23 +45,12 @@ function(app, FauxtonAPI, Documents, Databases) {
 
     },
 
-    routes: function() {
-      return _.keys(this.selectedRoutes);
-    },
-
-    selectedRoutes: {
+    routes: {
       "database/:database/:doc/field_editor": "field_editor",
       "database/:database/:doc/code_editor": "code_editor",
       "database/:database/:doc": "code_editor"
     },
 
-    events: {
-      "route:field_editor": "field_editor",
-      "route:code_editor": "code_editor"
-    },
-
-    defaultRoute: "code_editor",
-
     crumbs: function() {
       return [
         {"name": "Databases", "link": "/_all_dbs"},
@@ -89,7 +78,7 @@ function(app, FauxtonAPI, Documents, Databases) {
     }
   });
 
-  var newViewEditorCallback = function(databaseName) {
+  /*var newViewEditorCallback = function(databaseName) {
     var data = {
       database: new Databases.Model({id:databaseName})
     };
@@ -128,13 +117,13 @@ function(app, FauxtonAPI, Documents, Databases) {
 
       apiUrl: data.database.url()
     };
-  };
+  };*/
 
   // HACK: this kind of works
   // Basically need a way to share state between different routes, for
   // instance making a new doc won't work for switching back and forth
   // between code and field editors
-  var newDocCodeEditorCallback = function(databaseName) {
+  /*var newDocCodeEditorCallback = function(databaseName) {
     var data = {
       database: new Databases.Model({id:databaseName}),
       doc: new Documents.NewDoc(),
@@ -176,21 +165,18 @@ function(app, FauxtonAPI, Documents, Databases) {
 
       apiUrl: data.doc.url()
     };
-  };
+  };*/
 
 
   var DocumentsRouteObject = FauxtonAPI.RouteObject.extend({
     layout: "with_tabs_sidebar",
 
-    events: {
-      "route:all_docs": "allDocs",
-      "route:all_design_docs": "allDesignDocs",
-      "route:view_fn": "viewFn",
-      "route:new_view": "newViewEditor"
+    routes: {
+      "database/:database/_all_docs(:extra)": "allDocs", 
+      "database/:database/_design/:ddoc/_view/:view": "viewFn",
+      "database/:database/new_view": "newViewEditor"
     },
 
-    defaultRoute: "allDocs",
-
     initialize: function (options) {
       var docOptions = app.getParams();
       docOptions.include_docs = true;
@@ -218,69 +204,35 @@ function(app, FauxtonAPI, Documents, Databases) {
       }));
     },
 
-    crumbs: function () {
-      return [
-        {"name": "Databases", "link": "/_all_dbs"},
-        {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)}
-      ];
-    },
 
-    allDocs: function(event) {
-      var docOptions;
+    allDocs: function(databaseName, options) {
+      var docOptions = app.getParams(options);
 
-      docOptions = app.getParams(event.attr);
       docOptions.include_docs = true;
-
       this.data.database.buildAllDocs(docOptions);
-      this.sidebar.setSelectedTab('all-docs');
-
-      this.documentsView = this.setView("#dashboard-content", new Documents.Views.AllDocsList({
-        collection: this.data.database.allDocs
-      }));
-    },
 
-    allDesignDocs: function(event) {
-      var docOptions = app.getParams(event.attr);
-      docOptions.include_docs = true;
-
-      this.data.database.buildAllDocs(docOptions);
-      this.sidebar.setSelectedTab('design-docs');
+      if (docOptions.startkey && docOptions.startkey.indexOf('_design') > -1) {
+        this.sidebar.setSelectedTab('design-docs');
+      } else {
+        this.sidebar.setSelectedTab('all-docs');
+      }
 
       this.documentsView = this.setView("#dashboard-content", new Documents.Views.AllDocsList({
         collection: this.data.database.allDocs
       }));
-    },
-
-    route: function (route, routeArgs) {
-      console.log('ROUTE ARG ', arguments);
-
-      if (route === 'database/:database/_design/:ddoc/_view/:view') {
 
-        if (!this.docCrumbs && !this.docApiUrl) {
-          // Save the old crumbs and API. Easier to do it here than in each event
-          this.docCrumbs = this.crumbs;
-          this.docApiUrl = this.apiUrl;
-        }
+      this.crumbs = [
+        {"name": "Databases", "link": "/_all_dbs"},
+        {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)}
+      ];
 
-        this.routeArgs = {
-          designDoc: routeArgs[1],
-          view: routeArgs[2].replace(/\?.*$/,'')
-        };
-      } else {
-        this.routeArgs = {};
-        if (this.docCrumbs && this.docApiUrl) {
-          this.crumbs = this.docCrumbs;
-          this.docApiUrl = this.apiUrl;
-        }
-      }
+      this.apiUrl = this.data.database.allDocs.url();
     },
 
-    viewFn: function (event) {
-      var view = this.routeArgs.view,
-      ddoc = this.routeArgs.designDoc,
-      params = app.getParams(event.attr);
+    viewFn: function (databaseName, ddoc, view) {
+      var params = app.getParams();
 
-      console.log('PARAMS', params);
+      view = view.replace(/\?.*$/,'');
 
       this.data.indexedDocs = new Documents.IndexCollection(null, {
         database: this.data.database,
@@ -303,6 +255,8 @@ function(app, FauxtonAPI, Documents, Databases) {
         params: params
       }));
 
+      this.sidebar.setSelectedTab(ddoc + '_' + view);
+
       this.crumbs = function () {
         return [
           {"name": "Databases", "link": "/_all_dbs"},
@@ -311,7 +265,6 @@ function(app, FauxtonAPI, Documents, Databases) {
         ];
       };
 
-      // TODO: change to view URL
       this.apiUrl = this.data.indexedDocs.url();
     },
 
@@ -322,13 +275,10 @@ function(app, FauxtonAPI, Documents, Databases) {
         ddocs: this.data.designDocs
       }));
 
-    },
-
-    routes: ["database/:database/_all_docs(:extra)", "database/:database/_design/:ddoc/_view/:view", "database/:database/new_view"],
+      this.sidebar.setSelectedTab('new-view');
 
-    apiUrl: function() {
-      return this.data.database.allDocs.url();
     }
+
   });
 
 
@@ -344,14 +294,10 @@ function(app, FauxtonAPI, Documents, Databases) {
       ];
     },
 
-    routes: ["database/:database/_changes(:params)"],
-
-    events: {
-      "route:_changes": "changes"
+    routes: {
+      "database/:database/_changes(:params)": "changes"
     },
 
-    defaultRoute: "changes",
-
     initialize: function (options) {
       this.databaseName = options[0];
       this.database = new Databases.Model({id: this.databaseName});
@@ -385,78 +331,9 @@ function(app, FauxtonAPI, Documents, Databases) {
      return codeEditorCallback(database, docID);
      },
 
-
-
      "database/:database/new": newDocCodeEditorCallback,
      "database/:database/new_view": newViewEditorCallback,
-
-  // TODO: fix optional search params
-  // Can't get ":view(?*search)" to work
-  // However ":view?*search" does work
-  //"database/:database/_design/:ddoc/_view/:view(\?*options)": function(databaseName, ddoc, view, options) {
-  "database/:database/_design/:ddoc/_view/:view": function(databaseName, ddoc, view, options) {
-// hack around backbone router limitations
-view = view.replace(/\?.*$/,'');
-var params = app.getParams();
-var data = {
-database: new Databases.Model({id:databaseName})
-};
-
-data.indexedDocs = new Documents.IndexCollection(null, {
-database: data.database,
-design: ddoc,
-view: view,
-params: params
-});
-
-data.designDocs = new Documents.AllDocs(null, {
-database: data.database,
-params: {startkey: '"_design"',
-endkey: '"_design1"',
-include_docs: true}
-});
-
-var ddocInfo = {
-id: "_design/" + ddoc,
-currView: view,
-designDocs: data.designDocs
-};
-
-return {
-layout: "with_tabs_sidebar",
-
-data: data,
-  // TODO: change dashboard-content
-views: {
-"#dashboard-content": new Documents.Views.AllDocsList({
-collection: data.indexedDocs,
-nestedView: Documents.Views.Row,
-viewList: true,
-ddocInfo: ddocInfo,
-params: params
-}),
-
-"#sidebar-content": new Documents.Views.Sidebar({
-collection: data.designDocs,
-ddocInfo: ddocInfo
-}),
-
-"#tabs": new Documents.Views.Tabs({
-collection: data.designDocs,
-database: data.database
-})
-},
-
-crumbs: [
-{"name": "Databases", "link": "/_all_dbs"},
-{"name": data.database.id, "link": Databases.databaseUrl(data.database)},
-{"name": ddoc + "/" + view, "link": data.indexedDocs.url()}
-],
-  // TODO: change to view URL
-  apiUrl: data.indexedDocs.url()
-  };
-}
-};*/
+    };*/
 
   Documents.RouteObjects = [DocEditorRouteObject, DocumentsRouteObject, ChangesRouteObject];
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index 6ac9b44..17bf9af 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -396,7 +396,6 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
       var fragment = window.location.hash.replace(/\?.*$/, '');
       fragment = fragment + '?' + $.param(params);
       FauxtonAPI.navigate(fragment);
-      FauxtonAPI.triggerRouteEvent('view_fn', params);
     },
 
     updateFilters: function(event) {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/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 3bcae5d..7e8f791 100644
--- a/src/fauxton/app/modules/fauxton/base.js
+++ b/src/fauxton/app/modules/fauxton/base.js
@@ -156,7 +156,6 @@ function(app, Backbone) {
       this.total = options.total;
       this.totalPages = Math.ceil(this.total / this.perPage);
       this.urlFun = options.urlFun;
-      this.routeEvent = options.routeEvent;
 
     },
 
@@ -166,8 +165,7 @@ function(app, Backbone) {
         perPage: this.perPage,
         total: this.total,
         totalPages: this.totalPages,
-        urlFun: this.urlFun,
-        routeEvent: this.routeEvent
+        urlFun: this.urlFun
       };
     }
   });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/src/fauxton/app/router.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/router.js b/src/fauxton/app/router.js
index 09b2338..45cc8b2 100644
--- a/src/fauxton/app/router.js
+++ b/src/fauxton/app/router.js
@@ -44,80 +44,30 @@ define([
 
 function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases, Documents, Pouch, LoadAddons) {
 
-  var defaultLayout = 'with_sidebar';
   // TODO: auto generate this list if possible
   var modules = [Databases, Documents];
 
-  var generateRoute = function(settingsGenerator, route) {
-    return function() {
-      var boundRoute = route;
-      var settings = settingsGenerator.apply(null, arguments);
-      var layout = settings.layout || defaultLayout;
-      var establish = settings.establish || function() { return null; };
-      var masterLayout = this.masterLayout;
-
-      console.log("Settings generator for: ", layout, settings);
-
-      masterLayout.setTemplate(layout);
-      masterLayout.clearBreadcrumbs();
-
-      if (settings.crumbs) {
-        masterLayout.setBreadcrumbs(new Fauxton.Breadcrumbs({
-          crumbs: settings.crumbs
-        }));
-      }
-
-      $.when.apply(null, establish()).done(function(resp) {
-        _.each(settings.views, function(view, selector) {
-          masterLayout.setView(selector, view);
-
-          $.when.apply(null, view.establish()).then(function(resp) {
-            masterLayout.renderView(selector);
-          }, function(resp) {
-            view.establishError = {
-              error: true,
-              reason: resp
-            };
-            masterLayout.renderView(selector);
-          });
-
-          var hooks = masterLayout.hooks[selector];
-
-          if(hooks){
-            _.each(hooks, function(hook){
-              if (_.any(hook.routes, function(route){return route == boundRoute;})){
-                hook.callback(view);
-              }
-            });
-          }
-        });
-      });
-
-      if (settings.apiUrl) this.apiBar.update(settings.apiUrl);
-    };
-  };
-
   var Router = app.router = Backbone.Router.extend({
     routes: {},
 
     addModuleRouteObject: function(RouteObject) {
       var self = this;
-      var masterLayout = this.masterLayout;
+      var masterLayout = this.masterLayout,
+          routeUrls = RouteObject.prototype.getRouteUrls();
 
-      _.each(RouteObject.prototype.get('routes'), function(route) {
+      _.each(routeUrls, function(route) {
         this.route(route, route.toString(), function() {
           var args = Array.prototype.slice.call(arguments);
 
-          if (self.activeRouteObject && self.activeRouteObject.get('routes').indexOf(route) > -1) {
-            //Don't need to do anything here as this route has been initialised
-            self.activeRouteObject.route.call(self.activeRouteObject, route, args);
-            console.log('Avoiding Route creation');
-            return;
+          if (!self.activeRouteObject || !self.activeRouteObject.hasRoute(route)) {
+            self.activeRouteObject = new RouteObject(args);
           }
 
-          self.activeRouteObject = new RouteObject(args);
-          self.activeRouteObject[self.activeRouteObject.defaultRoute].apply(self.activeRouteObject, args);
-          self.activeRouteObject.render(route, masterLayout, args);
+          var routeObject = self.activeRouteObject,
+              routeCallback = routeObject.routeCallback(route);
+
+          routeCallback.apply(routeObject, args);
+          routeObject.render(route, masterLayout, args);
         });
       }, this);
     },

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/doc_field_editor_tabs.html b/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
index b094e0e..41bbe40 100644
--- a/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
+++ b/src/fauxton/app/templates/documents/doc_field_editor_tabs.html
@@ -13,8 +13,8 @@ the License.
 -->
 
 <ul class="nav nav-tabs">
-  <li id="field_editor" class="<%= isSelectedClass('field_editor') %>"><a route-event="field_editor" href="#<%= doc.url('app') %>/field_editor">Doc fields</a></li>
-  <li id="code_editor" class="<%= isSelectedClass('code_editor') %>"><a route-event="code_editor" href="#<%= doc.url('app') %>/code_editor"><i class="icon-pencil"></i> Code editor</a></li>
+  <li id="field_editor" class="<%= isSelectedClass('field_editor') %>"><a href="#<%= doc.url('app') %>/field_editor">Doc fields</a></li>
+  <li id="code_editor" class="<%= isSelectedClass('code_editor') %>"><a href="#<%= doc.url('app') %>/code_editor"><i class="icon-pencil"></i> Code editor</a></li>
   <ul class="nav pull-right" style="margin:5px 10px 0px 10px;">
     <li>
       <div class="btn-group">

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/src/fauxton/app/templates/documents/index_menu_item.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/index_menu_item.html b/src/fauxton/app/templates/documents/index_menu_item.html
index 2dac868..cb9aaf0 100644
--- a/src/fauxton/app/templates/documents/index_menu_item.html
+++ b/src/fauxton/app/templates/documents/index_menu_item.html
@@ -12,6 +12,6 @@ License for the specific language governing permissions and limitations under
 the License.
 -->
 
-<a route-event="view_fn" href="#database/<%= database %>/_design/<%= ddoc %>/_view/<%= index %>" class="toggle-view">
+<a id="<%= ddoc %>_<%= index %>" href="#database/<%= database %>/_design/<%= ddoc %>/_view/<%= index %>" class="toggle-view">
   <i class="icon-list"></i> <%= ddoc %><span class="divider">/</span><%= index %>
 </a>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/src/fauxton/app/templates/documents/sidebar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/sidebar.html b/src/fauxton/app/templates/documents/sidebar.html
index a8841a2..b573725 100644
--- a/src/fauxton/app/templates/documents/sidebar.html
+++ b/src/fauxton/app/templates/documents/sidebar.html
@@ -19,11 +19,11 @@ the License.
   </div>
   <hr>
   <ul class="nav nav-list">
-    <li class="active"><a route-event="all_docs" id="all-docs" href="#<%= database.url('index') %>?limit=100" class="toggle-view"><i class="icon-list"></i> All documents</a></li>
-    <li><a route-event="all_design_docs" id="design-docs" href='#<%= database.url("index") %>?limit=100&startkey="_design"&endkey="_e"'  class="toggle-view"><i class="icon-list"></i> All design docs</a></li>
+    <li class="active"><a id="all-docs" href="#<%= database.url('index') %>?limit=100" class="toggle-view"><i class="icon-list"></i> All documents</a></li>
+    <li><a id="design-docs" href='#<%= database.url("index") %>?limit=100&startkey="_design"&endkey="_e"'  class="toggle-view"><i class="icon-list"></i> All design docs</a></li>
   </ul>
   <ul class="nav nav-list views">
     <li class="nav-header">Secondary Indexes</li>
-    <li><a route-event="new_view" href="#<%= database.url('app') %>/new_view" class="new"><i class="icon-plus"></i> New</a></li>
+    <li><a id="new-view" href="#<%= database.url('app') %>/new_view" class="new"><i class="icon-plus"></i> New</a></li>
   </ul>
 </div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b01651b5/src/fauxton/app/templates/fauxton/pagination.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/pagination.html b/src/fauxton/app/templates/fauxton/pagination.html
index 2ec5ebe..e808aaa 100644
--- a/src/fauxton/app/templates/fauxton/pagination.html
+++ b/src/fauxton/app/templates/fauxton/pagination.html
@@ -1,17 +1,17 @@
 <div class="pagination pagination-centered">
   <ul>
     <% if (page > 1) { %>
-    <li><a route-event="<%= routeEvent %>" href="<%= urlFun(page-1) %>">&laquo;</a></li>
+    <li> <a href="<%= urlFun(page-1) %>">&laquo;</a></li>
     <% } else { %>
-      <li class="disabled"><a a route-event="<%= routeEvent %>" href="<%= urlFun(page) %>">&laquo;</a></li>
+      <li class="disabled"> <a href="<%= urlFun(page) %>">&laquo;</a></li>
     <% } %>
     <% _.each(_.range(1, totalPages+1), function(i) { %>
-      <li <% if (page == i) { %>class="active"<% } %>><a route-event="<%= routeEvent %>" href="<%= urlFun(i) %>"><%= i %></a></li>
+      <li <% if (page == i) { %>class="active"<% } %>> <a href="<%= urlFun(i) %>"><%= i %></a></li>
     <% }) %>
     <% if (page < totalPages) { %>
-      <li><a route-event="<%= routeEvent %>" href="<%= urlFun(page+1) %>">&raquo;</a></li>
+      <li><a href="<%= urlFun(page+1) %>">&raquo;</a></li>
     <% } else { %>
-      <li class="disabled"><a route-event="<%= routeEvent %>" href="<%= urlFun(page) %>">&raquo;</a></li>
+      <li class="disabled"> <a href="<%= urlFun(page) %>">&raquo;</a></li>
     <% } %>
   </ul>
 </div>