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/12/12 10:23:12 UTC
git commit: updated refs/heads/master to 936edf8
Updated Branches:
refs/heads/master 9c641f167 -> 936edf85f
Fauxton: View fixes
On saving new view contiue to show edit index
Add new design doc to collection on save
Reload view list when bulk or single deleting design doc
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/936edf85
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/936edf85
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/936edf85
Branch: refs/heads/master
Commit: 936edf85f362715f4fda5a3706799686b38cda68
Parents: 9c641f1
Author: Garren Smith <ga...@gmail.com>
Authored: Thu Dec 12 11:11:28 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Thu Dec 12 11:11:28 2013 +0200
----------------------------------------------------------------------
src/fauxton/app/modules/documents/views.js | 30 ++++++++++++++++----
.../app/templates/documents/view_editor.html | 6 ++--
2 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/936edf85/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 de21010..49c443d 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -371,6 +371,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
});
that.model.collection.remove(that.model.id);
+ if (!!that.model.id.match('_design')) {
+ FauxtonAPI.triggerRouteEvent('reloadDesignDocs');
+ }
}, function(resp) {
FauxtonAPI.addNotification({
msg: "Failed to destroy your doc!",
@@ -639,6 +642,10 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
});
model.collection.remove(model.id);
+ console.log(model.id.match('_design'), !!model.id.match('_design'));
+ if (!!model.id.match('_design')) {
+ FauxtonAPI.triggerRouteEvent('reloadDesignDocs');
+ }
that.$('.bulk-delete').addClass('disabled');
}, function(resp) {
FauxtonAPI.addNotification({
@@ -1159,7 +1166,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
views: {},
language: "javascript"
};
- return new this.DocModel(doc, {database: this.database});
+ var ddoc = new this.DocModel(doc, {database: this.database});
+ this.collection.add(ddoc);
+ return ddoc;
} else {
var ddocName = this.$('#ddoc').val();
return this.collection.find(function (ddoc) {
@@ -1201,8 +1210,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
this.ddocID = options.ddocInfo.id;
this.viewName = options.viewName;
this.ddocInfo = new Documents.DdocInfo({_id: this.ddocID},{database: this.database});
- }
+ }
+ this.showIndex = false;
_.bindAll(this);
},
@@ -1285,6 +1295,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
ddoc.setDdocView(viewName, mapVal, reduceVal);
ddoc.save().then(function () {
+ that.mapEditor.editSaved();
+ that.reduceEditor && that.reduceEditor.editSaved();
+
FauxtonAPI.addNotification({
msg: "View has been saved.",
type: "success",
@@ -1295,9 +1308,13 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
var fragment = '/database/' + that.database.id +'/' + ddocName + '/_view/' + viewName;
FauxtonAPI.navigate(fragment, {trigger: false});
- FauxtonAPI.triggerRouteEvent('reloadDesignDocs',{selectedTab: ddocName.replace('_design/','') + '_' + viewName});
-
that.newView = false;
+ that.ddocID = ddoc.id;
+ that.viewName = viewName;
+ that.ddocInfo = ddoc;
+ that.showIndex = true;
+ that.render();
+ FauxtonAPI.triggerRouteEvent('reloadDesignDocs',{selectedTab: ddocName.replace('_design/','') + '_' + viewName});
}
if (that.reduceFunStr !== reduceVal) {
@@ -1538,8 +1555,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
}
this.designDocSelector.updateDesignDoc();
- if (this.newView) {
+ if (this.newView || this.showIndex) {
this.showEditors();
+ this.showIndex = false;
} else {
this.$('#index').hide();
this.$('#index-nav').parent().removeClass('active');
@@ -1566,6 +1584,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
//this.reduceEditor.setValue(this.langTemplates[this.defaultLang].reduce);
}
+ this.mapEditor.editSaved();
+ this.reduceEditor && this.reduceEditor.editSaved();
},
cleanup: function () {
http://git-wip-us.apache.org/repos/asf/couchdb/blob/936edf85/src/fauxton/app/templates/documents/view_editor.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/view_editor.html b/src/fauxton/app/templates/documents/view_editor.html
index 8865625..cf6aa26 100644
--- a/src/fauxton/app/templates/documents/view_editor.html
+++ b/src/fauxton/app/templates/documents/view_editor.html
@@ -13,10 +13,10 @@ the License.
-->
<div class="row">
<ul class="nav nav-tabs window-resizeable" id="db-views-tabs-nav">
- <li class="active"> <a id="index-nav" class="fonticon-wrench fonticon" data-toggle="tab" href="#index"><% if (newView) { %>Create Index <% } else { %>Edit Index <% } %></a></li>
+ <li class="active"> <a data-bypass="true" id="index-nav" class="fonticon-wrench fonticon" data-toggle="tab" href="#index"><% if (newView) { %>Create Index <% } else { %>Edit Index <% } %></a></li>
<% if (!newView) { %>
- <li><a id="query-nav" class="fonticon-plus fonticon" href="#query" data-toggle="tab">Query Options</a></li>
- <li><a id="meta-nav" href="#metadata" data-toggle="tab">Design Doc Metadata</a></li>
+ <li><a data-bypass="true" id="query-nav" class="fonticon-plus fonticon" href="#query" data-toggle="tab">Query Options</a></li>
+ <li><a data-bypass="true" id="meta-nav" href="#metadata" data-toggle="tab">Design Doc Metadata</a></li>
<% } %>
</ul>
<div class="all-docs-list errors-container"></div>