Update views page for reduce funcs

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/47f3d338
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/47f3d338
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/47f3d338

Branch: refs/heads/fauxton
Commit: 47f3d33824905a1f73c782e2c9d48f885682e2c5
Parents: cfb0db9
Author: Russell Branca <chewbra...@gmail.com>
Authored: Wed Jan 9 12:58:47 2013 -0800
Committer: Russell Branca <chewbra...@gmail.com>
Committed: Wed Jan 9 12:58:47 2013 -0800

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/resources.js |    2 +-
 src/fauxton/app/modules/documents/views.js     |   12 +++---------
 2 files changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/47f3d338/src/fauxton/app/modules/documents/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/resources.js 
b/src/fauxton/app/modules/documents/resources.js
index 2a15cf8..f7bf80a 100644
--- a/src/fauxton/app/modules/documents/resources.js
+++ b/src/fauxton/app/modules/documents/resources.js
@@ -46,7 +46,7 @@ function(app, FauxtonAPI, Views) {
     hasViews: function() {
       if (!this.isDdoc()) return false;
       var doc = this.get('doc');
-      return doc && doc.views && doc.views.length > 0;
+      return doc && doc.views && _.keys(doc.views).length > 0;
     },
 
     getDdocView: function(view) {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/47f3d338/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 5c5f3cc..06da9ee 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -277,21 +277,15 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
         _.each(this.params, function(val, key) {
           switch (key) {
             case "limit":
-              $form.find("select[name=limit]").val(val);
+            case "group_level":
+              $form.find("select[name='"+key+"']").val(val);
               break;
             case "include_docs":
-              if (val == "true") {
-                $form.find("input[name=include_docs]").prop('checked', true);
-              }
-              break;
             case "reduce":
               if (val == "true") {
-                $form.find("input[reduce]").prop('checked', true);
+                $form.find("input[name='"+key+"']").prop('checked', true);
               }
               break;
-            case "group_level":
-              $form.find("select[name=group_level]").attr('selected', val);
-              break;
             default:
               $form.find("input[name='"+key+"']").val(val);
               break;

Reply via email to