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/04/24 16:46:34 UTC
git commit: updated refs/heads/route-events to 018c6e3
Updated Branches:
refs/heads/route-events fbfbfb42c -> 018c6e3d2
convert logs, stats, config and changes to route object
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/018c6e3d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/018c6e3d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/018c6e3d
Branch: refs/heads/route-events
Commit: 018c6e3d28932553738be36e6510813c8a463847
Parents: fbfbfb4
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Apr 24 16:46:11 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Apr 24 16:46:11 2013 +0200
----------------------------------------------------------------------
src/fauxton/app/addons/config/routes.js | 54 +++++++++-------
src/fauxton/app/addons/logs/routes.js | 1 -
src/fauxton/app/addons/stats/base.js | 4 +-
src/fauxton/app/addons/stats/resources.js | 2 +-
src/fauxton/app/addons/stats/routes.js | 57 +++++++----------
src/fauxton/app/addons/stats/views.js | 4 +-
src/fauxton/app/modules/documents/routes.js | 48 ++++++++++++++-
src/fauxton/app/router.js | 4 +-
src/fauxton/app/templates/layouts/with_tabs.html | 2 +-
src/fauxton/assets/index.underscore | 1 +
10 files changed, 110 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/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 7ed6498..d1495f4 100644
--- a/src/fauxton/app/addons/config/routes.js
+++ b/src/fauxton/app/addons/config/routes.js
@@ -11,34 +11,42 @@
// the License.
define([
- "app",
+ "app",
- "api",
+ "api",
- // Modules
- "addons/config/resources"
+ // Modules
+ "addons/config/resources"
],
function(app, FauxtonAPI, Config) {
- var configRoute = function () {
- var configs = new Config.Collection();
-
- return {
- layout: "one_pane",
- crumbs: [
- {"name": "Config","link": "_config"}
- ],
- views: {
- "#dashboard-content": new Config.View({collection: configs})
- },
- apiUrl: configs.url()
- };
- };
-
- Config.Routes = {
- "_config": configRoute
- };
- return Config;
+ var ConfigRouteObject = FauxtonAPI.RouteObject.extend({
+ layout: "one_pane",
+
+ crumbs: [
+ {"name": "Config","link": "_config"}
+ ],
+
+ apiUrl: function () {
+ this.configs.url();
+ },
+
+ routes: ["_config"],
+
+ views: function () {
+ this.configs = new Config.Collection();
+ this.setView("#dashboard-content", new Config.View({collection: this.configs}));
+ return {};
+ },
+
+ establish: function () {
+ return [this.configs.fetch()];
+ }
+ });
+
+
+ Config.RouteObjects = [new ConfigRouteObject()];
+ return Config;
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/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 177032c..b073074 100644
--- a/src/fauxton/app/addons/logs/routes.js
+++ b/src/fauxton/app/addons/logs/routes.js
@@ -42,7 +42,6 @@ function(app, FauxtonAPI, Log) {
},
route: function() {
- console.log('boom');
},
establish: function() {
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/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 33316c4..4721399 100644
--- a/src/fauxton/app/addons/stats/base.js
+++ b/src/fauxton/app/addons/stats/base.js
@@ -16,13 +16,11 @@ define([
"addons/stats/routes"
],
-function(app, FauxtonAPI, AddonRoutes) {
- var Stats = new FauxtonAPI.addon();
+function(app, FauxtonAPI, Stats) {
Stats.initialize = function() {
FauxtonAPI.addHeaderLink({title: "Statistics", href: "#stats"});
};
- Stats.Routes = AddonRoutes;
return Stats;
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/src/fauxton/app/addons/stats/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/stats/resources.js b/src/fauxton/app/addons/stats/resources.js
index 238a032..94be6bb 100644
--- a/src/fauxton/app/addons/stats/resources.js
+++ b/src/fauxton/app/addons/stats/resources.js
@@ -19,7 +19,7 @@ define([
],
function (app, FauxtonAPI, backbone, _, Fauxton) {
- var Stats = {};
+ var Stats = new FauxtonAPI.addon();
Stats.Collection = Backbone.Collection.extend({
model: Backbone.Model,
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/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 84947fa..c473eb0 100644
--- a/src/fauxton/app/addons/stats/routes.js
+++ b/src/fauxton/app/addons/stats/routes.js
@@ -11,49 +11,40 @@
// the License.
define([
- "app",
- "api",
- "addons/stats/resources",
- "addons/stats/views"
+ "app",
+ "api",
+ "addons/stats/views"
],
-function(app, FauxtonAPI, Stats, Views) {
- var data = {
- stats: new Stats.Collection()
- };
+function(app, FauxtonAPI, Stats) {
- var deferred = FauxtonAPI.Deferred();
+ var StatsRouteObject = FauxtonAPI.RouteObject.extend({
+ layout: "with_sidebar",
- var routeCallback = function() {
- return {
- layout: "with_sidebar",
+ routes: ["stats", "_stats"],
+ views: function () {
+ this.stats = new Stats.Collection();
- data: data,
- crumbs: [],
+ this.setView("#sidebar-content", new Views.StatSelect({
+ collection: this.stats
+ }));
- views: {
- "#sidebar-content": new Views.StatSelect({
- collection: data.stats
- }),
+ this.setView("#dashboard-content", new Views.Statistics({
+ collection: this.stats
+ }));
- "#dashboard-content": new Views.Statistics({
- collection: data.stats
- })
- },
+ return {};
+ },
- establish: function() {
- return [data.stats.fetch()];
- },
+ establish: function() {
+ return [this.stats.fetch()];
+ },
- apiUrl: "_stats"
- };
- };
+ apiUrl: "_stats"
+ });
- Routes = {
- "stats": routeCallback,
- "_stats": routeCallback
- };
+ Stats.RouteObjects = [new StatsRouteObject()];
- return Routes;
+ return Stats;
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/src/fauxton/app/addons/stats/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/stats/views.js b/src/fauxton/app/addons/stats/views.js
index 21454f9..9fda708 100644
--- a/src/fauxton/app/addons/stats/views.js
+++ b/src/fauxton/app/addons/stats/views.js
@@ -168,5 +168,7 @@ function(app, FauxtonAPI,Stats) {
}
});
- return Views;
+ Stats.Views = Views;
+
+ return Stats;
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/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 488865b..f2eaf8b 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -233,6 +233,52 @@ function(app, FauxtonAPI, Documents, Databases) {
+ var ChangesRouteObject = FauxtonAPI.RouteObject.extend({
+ layout: "with_tabs",
+
+ crumbs: function () {
+ return [
+ {"name": "Databases", "link": "/_all_dbs"},
+ {"name": this.database.id, "link": Databases.databaseUrl(this.database)},
+ {"name": "_changes", "link": "/_changes"}
+ ];
+ },
+
+ routes: ["database/:database/_changes(:params)"],
+
+ apiUrl: function() {
+ return this.database.changes.url();
+ },
+
+ route: function(route, params) {
+ this.databaseName = params[0];
+ },
+
+ views: function () {
+ this.database = new Databases.Model({id: this.databaseName});
+
+ var options = app.getParams();
+ this.database.buildChanges(options);
+
+
+ this.setView("#dashboard-content", new Documents.Views.Changes({
+ model: this.database
+ }));
+
+ this.setView("#tabs", new Documents.Views.Tabs({
+ collection: this.designDocs,
+ database: this.database,
+ active_id: 'changes'
+ }));
+
+ return {};
+ }
+
+ });
+
+
+
+
/* Documents.Routes = {
//"database/:database/:doc/code_editor": codeEditorCallback,
@@ -392,7 +438,7 @@ crumbs: [
}
};*/
-Documents.RouteObjects = [/*new DocEditorRouteObject(),*/ new DocumentsRouteObject()];
+ Documents.RouteObjects = [new DocEditorRouteObject(), new DocumentsRouteObject(), new ChangesRouteObject()];
return Documents;
});
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/src/fauxton/app/router.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/router.js b/src/fauxton/app/router.js
index c2270df..5d97a13 100644
--- a/src/fauxton/app/router.js
+++ b/src/fauxton/app/router.js
@@ -99,7 +99,6 @@ function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases, Documents
var Router = app.router = Backbone.Router.extend({
routes: {},
- routeObjects: [],
// These moduleRoutes functions are aguably better outside but
// need access to the Router instance which is not created in this
@@ -110,13 +109,12 @@ function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases, Documents
addModuleRouteObject: function(routeObject) {
var self = this;
- this.routeObjects.push(routeObject);
- console.log(routeObject);
var masterLayout = this.masterLayout;
_.each(routeObject.get('routes'), function(route) {
this.route(route, route.toString(), function() {
if (self.activeRouteObject && routeObject !== self.activeRouteObject) {
self.activeRouteObject.renderedState = false;
+ self.activeRouteObject.clearViews();
}
routeObject.render(route, masterLayout, Array.prototype.slice.call(arguments));
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/src/fauxton/app/templates/layouts/with_tabs.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/layouts/with_tabs.html b/src/fauxton/app/templates/layouts/with_tabs.html
index 432a68d..36b39c8 100644
--- a/src/fauxton/app/templates/layouts/with_tabs.html
+++ b/src/fauxton/app/templates/layouts/with_tabs.html
@@ -13,7 +13,7 @@ the License.
-->
<div id="primary-navbar"></div>
-<div id="dashboard" class="container">
+<div id="dashboard" class="container-fluid">
<div class="row-fluid">
<div id="breadcrumbs" class="row-fluid"></div>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/018c6e3d/src/fauxton/assets/index.underscore
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/index.underscore b/src/fauxton/assets/index.underscore
index 2b5c009..e29b4c4 100644
--- a/src/fauxton/assets/index.underscore
+++ b/src/fauxton/assets/index.underscore
@@ -19,6 +19,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
+ <meta http-equiv="Content-Language" content="en" />
<title>Project Fauxton</title>