You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2013/03/15 22:50:08 UTC

[23/50] git commit: Clean up for bugs and non save/preview use

Clean up for bugs and non save/preview use


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

Branch: refs/heads/fauxton-rebase
Commit: ee1fbe3cd6f2b642ea8531f9c51e43bbc810c251
Parents: 02ec66d
Author: Russell Branca <ch...@gmail.com>
Authored: Tue Mar 5 16:25:15 2013 -0800
Committer: Russell Branca <ch...@gmail.com>
Committed: Fri Mar 15 14:35:40 2013 -0700

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js         |   19 ++++++++++----
 .../app/templates/documents/all_docs_list.html     |    2 +
 .../app/templates/documents/view_editor.html       |   13 ++++-----
 3 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ee1fbe3c/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 8dbdda8..70ebb6a 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -661,7 +661,7 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
     initialize: function(options) {
       this.ddocs = options.ddocs;
       this.viewCollection = options.viewCollection;
-      this.hasReduce = this.model.viewHasReduce(this.viewCollection.view);
+      this.reduceFunStr = this.model.viewHasReduce(this.viewCollection.view);
       this.newView = false;
     },
 
@@ -711,10 +711,17 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
       if (this.hasValidCode()) {
         var mapVal = this.mapEditor.getValue();
         var reduceVal = this.reduceEditor.getValue();
+        /*
         notification = FauxtonAPI.addNotification({
           msg: "Saving document.",
           selector: "#define-view .errors-container"
         });
+        */
+        FauxtonAPI.addNotification({
+          msg: "Save Functionality Coming Soon",
+          type: "warning",
+          selector: "#define-view .errors-container"
+        });
         /*
         this.model.save().error(function(xhr) {
           var responseText = JSON.parse(xhr.responseText).reason;
@@ -791,17 +798,17 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
         ddocs: this.ddocs,
         ddoc: this.model,
         viewCollection: this.viewCollection,
-        hasReduce: this.hasReduce,
+        reduceFunStr: this.reduceFunStr,
+        isCustomReduce: this.hasCustomReduce(),
         newView: this.newView
       };
     },
 
     hasCustomReduce: function() {
-      return this.hasReduce && ! _.contains(this.builtinReduces, this.hasReduce);
+      return this.reduceFunStr && ! _.contains(this.builtinReduces, this.reduceFunStr);
     },
 
     afterRender: function() {
-      //this.model.on("sync", this.updateValues, this);
       var that = this;
       var mapFun = $("#map-function");
       var reduceFun = $("#reduce-function");
@@ -818,7 +825,7 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
           that.runJSHint("mapEditor");
         },
         extraKeys: {
-          "Ctrl-S": function(instance) { that.saveDoc(); },
+          "Ctrl-S": function(instance) { that.saveView(); },
           "Ctrl-/": "undo"
         }
       });
@@ -831,7 +838,7 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
           that.runJSHint("reduceEditor");
         },
         extraKeys: {
-          "Ctrl-S": function(instance) { that.saveDoc(); },
+          "Ctrl-S": function(instance) { that.saveView(); },
           "Ctrl-/": "undo"
         }
       });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ee1fbe3c/src/fauxton/app/templates/documents/all_docs_list.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/all_docs_list.html b/src/fauxton/app/templates/documents/all_docs_list.html
index cb8c55d..423a80d 100644
--- a/src/fauxton/app/templates/documents/all_docs_list.html
+++ b/src/fauxton/app/templates/documents/all_docs_list.html
@@ -122,6 +122,7 @@ the License.
   <table class="all-docs table table-striped table-condensed">
     <tbody></tbody>
   </table>
+  <!--
   <div class="pagination pagination-centered">
     <ul>
       <li class="disabled"><a href="#">&laquo;</a></li>
@@ -133,5 +134,6 @@ the License.
       <li><a href="#">&raquo;</a></li>
     </ul>
   </div>
+  -->
 
 </div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ee1fbe3c/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 1eceac2..4a8668e 100644
--- a/src/fauxton/app/templates/documents/view_editor.html
+++ b/src/fauxton/app/templates/documents/view_editor.html
@@ -19,7 +19,7 @@ the License.
         <i class="icon-wrench"></i> Edit Index
       </a>
     </div>
-    <div id="collapse-edit-index" class="accordion-body collapse in">
+    <div id="collapse-edit-index" class="accordion-body collapse">
       <div class="accordion-inner">
         <div id="define-view" class="ddoc-alert well">
           <div class="errors-container"></div>
@@ -59,12 +59,11 @@ the License.
               <label class="control-label" for="reduce-function-selector">Reduce function <a target="_couch_docs" href="http://docs.couchdb.org/en/latest/ddocs/#reduce-and-rereduce-functions"><i class="icon-question-sign"></i></a></label>
               <div class="controls">
                 <select id="reduce-function-selector">
-                  <% console.log("HAS REDUCE: ",hasReduce) %>
-                  <option value="" <%= !hasReduce ? 'selected="selected"' : '' %>>None</option>
-                  <option value="_sum">_sum</option>
-                  <option value="_count">_count</option>
-                  <option value="_stats">_stats</option>
-                  <option value="CUSTOM" <%= hasReduce ? 'selected="selected"' : '' %>>Custom reduce</option>
+                  <option value="" <%= !reduceFunStr ? 'selected="selected"' : '' %>>None</option>
+                  <% _.each(["_sum", "_count", "_stats"], function(reduce) { %>
+                    <option value="<%= reduce %>" <% if (reduce == reduceFunStr) { %>selected<% } %>><%= reduce %></option>
+                  <% }) %>
+                  <option value="CUSTOM" <% if (isCustomReduce) { %>selected<% } %>>Custom reduce</option>
                 </select>
                 <span class="help-block">Reduce functions are optional.</span>
               </div>