You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2013/12/16 21:03:29 UTC
[09/50] git commit: updated refs/heads/1744-single-config-file to
1c344a9
Fauxton: Add preview to edit index and fix preview bug
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/d2f1ec7a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/d2f1ec7a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/d2f1ec7a
Branch: refs/heads/1744-single-config-file
Commit: d2f1ec7af38d57fd248a49ebd64ba7b46b0828ff
Parents: 08cac68
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Dec 3 12:46:19 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Dec 3 17:26:11 2013 +0200
----------------------------------------------------------------------
src/fauxton/app/modules/documents/views.js | 22 +++++++++++++++++---
.../app/templates/documents/view_editor.html | 1 +
2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/d2f1ec7a/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 ffbc1d1..cf939e2 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -1164,7 +1164,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
"click button.save": "saveView",
"click button.delete": "deleteView",
"change select#reduce-function-selector": "updateReduce",
-
+ "click button.preview": "previewView",
"click #db-views-tabs-nav": 'toggleIndexNav'
},
@@ -1344,10 +1344,17 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
previewView: function(event, paramsInfo) {
+ event.preventDefault();
var that = this,
- mapVal = this.mapEditor.getValue(),
+ mapVal = this.mapVal(),
reduceVal = this.reduceVal(),
- paramsArr = paramsInfo.params;
+ paramsArr = [];
+
+ console.log(mapVal);
+
+ if (paramsInfo && paramsInfo.params) {
+ paramsArr = paramsInfo.params;
+ }
var params = _.reduce(paramsArr, function (params, param) {
params[param.name] = param.value;
@@ -1390,6 +1397,15 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
return $("#reduce-function-selector").val() == "CUSTOM";
},
+ mapVal: function () {
+
+ if (this.mapEditor) {
+ return this.mapEditor.getValue();
+ }
+
+ return this.$('#map-function').text();
+ },
+
reduceVal: function() {
var reduceOption = this.$('#reduce-function-selector :selected').val(),
reduceVal = "";
http://git-wip-us.apache.org/repos/asf/couchdb/blob/d2f1ec7a/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 f35b8ab..bb6e0af 100644
--- a/src/fauxton/app/templates/documents/view_editor.html
+++ b/src/fauxton/app/templates/documents/view_editor.html
@@ -67,6 +67,7 @@ the License.
<div class="control-group">
<button class="button green save fonticon-circle-check">Save</button>
+ <button class="button btn-info preview">Preview</button>
<% if (!this.newView) { %>
<button class="button delete outlineGray fonticon-circle-x">Delete</button>
<% } %>