Update changes for links to docs and a few other things
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/01f60f11
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/01f60f11
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/01f60f11
Branch: refs/heads/fauxton-rebase
Commit: 01f60f11e16ffa9861374de2cd95981847aafc64
Parents: b76c028
Author: Russell Branca <chewbranca@gmail.com>
Authored: Tue Feb 5 17:58:09 2013 -0800
Committer: Russell Branca <chewbranca@gmail.com>
Committed: Fri Mar 15 14:35:12 2013 -0700
----------------------------------------------------------------------
src/fauxton/app/modules/databases/resources.js | 2 +
src/fauxton/app/modules/documents/routes.js | 14 ++++++------
src/fauxton/app/modules/documents/views.js | 13 +++++------
src/fauxton/app/templates/documents/changes.html | 18 +++++++++++-----
4 files changed, 27 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/01f60f11/src/fauxton/app/modules/databases/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/resources.js b/src/fauxton/app/modules/databases/resources.js
index 73af4f7..0d2f311 100644
--- a/src/fauxton/app/modules/databases/resources.js
+++ b/src/fauxton/app/modules/databases/resources.js
@@ -34,6 +34,8 @@ function(app, FauxtonAPI, Documents) {
url: function(context) {
if (context === "index") {
return "/database/" + this.id + "/_all_docs";
+ } else if (context === "changes") {
+ return "/database/" + this.id + "/_changes?descending=true&limit=100";
} else if (context === "app") {
return "/database/" + this.id;
} else {
http://git-wip-us.apache.org/repos/asf/couchdb/blob/01f60f11/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 ab66670..6eddb03 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -1,11 +1,11 @@
define([
- "app",
+ "app",
- "api",
+ "api",
- // Modules
- "modules/documents/resources",
- "modules/databases/base"
+ // Modules
+ "modules/documents/resources",
+ "modules/databases/base"
],
function(app, FauxtonAPI, Documents, Databases) {
@@ -77,7 +77,7 @@ function(app, FauxtonAPI, Documents, Databases) {
crumbs: [
{"name": "Databases", "link": "/_all_dbs"},
- {"name": data.database.id, "link": Databases.databaseUrl(data.database)}
+ {"name": data.database.id, "link": data.database.url('app')}
],
views: {
@@ -321,7 +321,7 @@ function(app, FauxtonAPI, Documents, Databases) {
views: {
"#dashboard-content": new Documents.Views.Changes({
- collection: data.database.changes
+ model: data.database
}),
"#tabs": new Documents.Views.Tabs({
http://git-wip-us.apache.org/repos/asf/couchdb/blob/01f60f11/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 d41d53e..d11b96c 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -30,8 +30,8 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
serialize: function () {
return {
// TODO make this not hard coded here
- changes_url: '#database/'+ this.database.id + '/_changes?descending=true&limit=100',
- db_url: '#database/'+ this.database.id + '/_all_docs?limit=100'
+ changes_url: '#' + this.database.url('changes'),
+ db_url: '#' + this.database.url('index') + '?limit=100'
};
},
@@ -56,12 +56,10 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
if (!result) { return; }
- var promise = this.database.destroy();
- promise.done(function () {
+ return this.database.destroy().done(function () {
app.router.navigate('/', {trigger: true});
});
}
-
});
Views.SearchBox = FauxtonAPI.View.extend({
@@ -848,13 +846,14 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
establish: function() {
return [
- this.collection.fetch()
+ this.model.changes.fetch()
];
},
serialize: function () {
return {
- changes: this.collection.toJSON()
+ changes: this.model.changes.toJSON(),
+ database: this.model
};
}
http://git-wip-us.apache.org/repos/asf/couchdb/blob/01f60f11/src/fauxton/app/templates/documents/changes.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/changes.html b/src/fauxton/app/templates/documents/changes.html
index 9cdb30a..e9c191b 100644
--- a/src/fauxton/app/templates/documents/changes.html
+++ b/src/fauxton/app/templates/documents/changes.html
@@ -2,15 +2,21 @@
<thead>
<th> seq </th>
<th> id </th>
- <th changes </th>
+ <th> changes </th>
+ <th> deleted? </th>
</thead>
<tbody>
<% _.each(changes, function (change) { %>
- <tr>
- <td> <%= change.seq %> </td>
- <td> <%= change.id %> </td>
- <td> <%= JSON.stringify(change.changes) %> </td>
- </tr>
+ <tr>
+ <td> <%= change.seq %> </td>
+ <% if (change.deleted) { %>
+ <td> <%= change.id %> </td>
+ <% } else { %>
+ <td> <a href="#<%= database.url('app') %>/<%= change.id %>"><%=
change.id %></a> </td>
+ <% } %>
+ <td> <%= JSON.stringify(change.changes) %> </td>
+ <td><%= change.deleted ? "true" : "false" %></td>
+ </tr>
<% }); %>
</tbody>
</table>
|