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 2014/10/06 11:06:22 UTC
fauxton commit: updated refs/heads/master to 57701c9
Repository: couchdb-fauxton
Updated Branches:
refs/heads/master dcc5c6113 -> 57701c964
Fixes to creating views
Views are broken in a couple places:
* Does no display design doc after saving new view
* Sidebar has double render on '+' button
* Could not reduce on new view
* The results were not updating properly on on a save
This should fix all these issues
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/57701c96
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/57701c96
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/57701c96
Branch: refs/heads/master
Commit: 57701c9645363c1d95be5664a1f1d0fb60d53007
Parents: dcc5c61
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Oct 1 14:06:57 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Mon Oct 6 11:05:01 2014 +0200
----------------------------------------------------------------------
app/addons/documents/resources.js | 2 +-
.../templates/design_doc_selector.html | 2 --
app/addons/documents/views-index.js | 33 ++++++++++----------
app/addons/documents/views-sidebar.js | 8 ++---
app/addons/documents/views.js | 2 +-
5 files changed, 22 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/57701c96/app/addons/documents/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js
index 8077bfe..ef119ac 100644
--- a/app/addons/documents/resources.js
+++ b/app/addons/documents/resources.js
@@ -190,7 +190,7 @@ function(app, FauxtonAPI, PagingCollection) {
delete resp.rev;
}
if (resp.id) {
- if (typeof(this.id) === "undefined") {
+ if (_.isUndefined(this.id)) {
resp._id = resp.id;
}
}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/57701c96/app/addons/documents/templates/design_doc_selector.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/design_doc_selector.html b/app/addons/documents/templates/design_doc_selector.html
index d12cd64..2fcbadc 100644
--- a/app/addons/documents/templates/design_doc_selector.html
+++ b/app/addons/documents/templates/design_doc_selector.html
@@ -18,8 +18,6 @@ the License.
<option value="new-doc">New document</option>
<% ddocs.each(function(ddoc) { %>
- <%= ddoc.id %>
- <%= ddocName %>
<% if (ddoc.id === ddocName) { %>
<option selected="selected" value="<%- ddoc.id %>"><%- ddoc.id %></option>
<% } else { %>
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/57701c96/app/addons/documents/views-index.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-index.js b/app/addons/documents/views-index.js
index a21dc61..db4a83b 100644
--- a/app/addons/documents/views-index.js
+++ b/app/addons/documents/views-index.js
@@ -164,7 +164,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
ddoc.save().then(function () {
that.ddocs.add(ddoc);
-
that.mapEditor.editSaved();
that.reduceEditor && that.reduceEditor.editSaved();
@@ -184,6 +183,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
that.viewName = viewName;
that.ddocInfo = ddoc;
that.showIndex = true;
+ that.currentDdoc = ddoc;
that.render();
FauxtonAPI.triggerRouteEvent('reloadDesignDocs', {
selectedTab: app.utils.removeSpecialCharacters(ddocName.replace(/_design\//,'')) + '_' + app.utils.removeSpecialCharacters(viewName)
@@ -419,7 +419,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
var viewFilters = FauxtonAPI.getExtensions('sidebar:viewFilters'),
filteredModels = this.ddocs.models,
- designDocs = this.ddocs.clone();
+ designDocs = this.ddocs;
if (!_.isEmpty(viewFilters)) {
_.each(viewFilters, function (filter) {
@@ -427,12 +427,14 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
});
designDocs.reset(filteredModels, {silent: true});
}
-
- this.designDocSelector = this.setView('.design-doc-group', new Views.DesignDocSelector({
- collection: designDocs,
- ddocName: this.currentDdoc || this.model.id,
- database: this.database
- }));
+
+ if (!this.designDocSelector) {
+ this.designDocSelector = this.setView('.design-doc-group', new Views.DesignDocSelector({
+ collection: designDocs,
+ ddocName: this.currentDdoc || this.model.id,
+ database: this.database
+ }));
+ }
if (!this.newView) {
this.eventer = _.extend({}, Backbone.Events);
@@ -524,7 +526,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
ddocAdded: function (ddoc) {
this.ddocName = ddoc.id;
- this.render();
},
serialize: function () {
@@ -543,7 +544,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
},
newDesignDoc: function () {
-
return this.$('#ddoc').val() === 'new-doc';
},
@@ -558,14 +558,13 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
language: "javascript"
};
var ddoc = new this.DocModel(doc, {database: this.database});
- //this.collection.add(ddoc);
return ddoc;
- } else if ( !this.newDesignDoc() ) {
- var ddocName = this.$('#ddoc').val();
- return this.collection.find(function (ddoc) {
- return ddoc.id === ddocName;
- }).dDocModel();
- }
+ }
+
+ var ddocName = this.$('#ddoc').val();
+ return this.collection.find(function (ddoc) {
+ return ddoc.id === ddocName;
+ }).dDocModel();
}
});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/57701c96/app/addons/documents/views-sidebar.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-sidebar.js b/app/addons/documents/views-sidebar.js
index e3eaeda..9ce2ca6 100644
--- a/app/addons/documents/views-sidebar.js
+++ b/app/addons/documents/views-sidebar.js
@@ -93,15 +93,15 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
links: this.getNewButtonLinks()
}];
- this.insertView("#new-all-docs-button", new Components.MenuDropDown({
+ this.setView("#new-all-docs-button", new Components.MenuDropDown({
links: newLinks,
}));
- this.insertView("#new-design-docs-button", new Components.MenuDropDown({
+ this.setView("#new-design-docs-button", new Components.MenuDropDown({
links: newLinks,
}));
- _.each(this.designDocList, function (view) { view.remove();});
+ _.each(this.designDocList, function (view) { view.remove(); view = undefined;});
this.designDocList = [];
this.collection.each(function(design) {
@@ -225,7 +225,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
});
this.renderIndexLists();
- this.insertView(".new-button", new Components.MenuDropDown({
+ this.setView(".new-button", new Components.MenuDropDown({
links: sideBarMenuLinks,
}));
}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/57701c96/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index e9a13d1..fe6ce47 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -674,7 +674,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
if (this.bulkDeleteDocsCollection) {
isChecked = this.bulkDeleteDocsCollection.get(doc.id);
}
- this.rows[doc.id] = this.insertView("table.all-docs tbody", new this.nestedView({
+ this.rows[doc.get('id')] = this.insertView("table.all-docs tbody", new this.nestedView({
model: doc,
checked: isChecked
}));