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/03/13 18:52:00 UTC

[01/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Repository: couchdb
Updated Branches:
  refs/heads/2201-fix-new-view 695e216d2 -> cc3c37349 (forced update)


s/MVC/MVCC in replication protocol docs


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

Branch: refs/heads/2201-fix-new-view
Commit: b4332e437f12de4c65de7484d2d1cd0b52bd4d32
Parents: 0e33059
Author: BigBlueHat <by...@bigbluehat.com>
Authored: Mon Oct 21 10:02:11 2013 -0400
Committer: BigBlueHat <by...@bigbluehat.com>
Committed: Thu Mar 13 09:38:24 2014 -0400

----------------------------------------------------------------------
 share/doc/src/replication/protocol.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b4332e43/share/doc/src/replication/protocol.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/replication/protocol.rst b/share/doc/src/replication/protocol.rst
index c5a8181..0f6fdfd 100644
--- a/share/doc/src/replication/protocol.rst
+++ b/share/doc/src/replication/protocol.rst
@@ -40,7 +40,7 @@ provided by the couch_replicator_ module available in Apache CouchDB.
 
 The CouchDB_ replication protocol is using the `CouchDB REST API
 <http://wiki.apache.org/couchdb/Reference>`_ and so is based on HTTP and
-the Apache CouchDB MVC Data model. The primary goal of this
+the Apache CouchDB MVCC Data model. The primary goal of this
 specification is to describe the CouchDB replication algorithm.
 
 


[08/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Posted by ga...@apache.org.
Fauxton new view creation fix

Fixes issue COUCHDB-2201


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

Branch: refs/heads/2201-fix-new-view
Commit: 860eba7cbffb7eb67612a4bc45a6f1f1ca09fdb0
Parents: 4f7cb15
Author: Garren Smith <ga...@gmail.com>
Authored: Thu Mar 13 10:01:31 2014 -0400
Committer: Garren Smith <ga...@gmail.com>
Committed: Thu Mar 13 13:25:33 2014 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/documents/routes.js | 51 +++++++++++++++++--------
 src/fauxton/app/addons/documents/views.js  |  2 +
 2 files changed, 37 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/860eba7c/src/fauxton/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js
index ff518e4..67589d4 100644
--- a/src/fauxton/app/addons/documents/routes.js
+++ b/src/fauxton/app/addons/documents/routes.js
@@ -259,13 +259,7 @@ function(app, FauxtonAPI, Documents, Databases) {
         view: view,
         params: docParams
       });
-
-      var ddocInfo = {
-        id: "_design/" + decodeDdoc,
-        currView: view,
-        designDocs: this.data.designDocs
-      };
-
+     
       this.viewEditor = this.setView("#dashboard-upper-content", new Documents.Views.ViewEditor({
         model: this.data.database,
         ddocs: this.data.designDocs,
@@ -278,15 +272,13 @@ function(app, FauxtonAPI, Documents, Databases) {
 
       if (this.toolsView) { this.toolsView.remove(); }
 
-      this.documentsView = this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
-        database: this.data.database,
-        collection: this.data.indexedDocs,
-        nestedView: Documents.Views.Row,
-        viewList: true,
-        ddocInfo: ddocInfo,
-        docParams: docParams,
-        params: urlParams
-      }));
+      this.documentsView = this.createViewDocumentsView(
+        decodeDdoc,
+        docParams, 
+        urlParams,
+        this.data.database,
+        this.indexedDocs,
+        this.data.designDocs);
 
       this.sidebar.setSelectedTab(app.utils.removeSpecialCharacters(ddoc) + '_' + app.utils.removeSpecialCharacters(view));
 
@@ -300,6 +292,24 @@ function(app, FauxtonAPI, Documents, Databases) {
       Documents.paginate.reset();
     },
 
+    createViewDocumentsView: function (designDoc, docParams, urlParams, database, indexedDocs, designDocs) {
+       var ddocInfo = {
+        id: "_design/" + designDocs,
+        currView: view,
+        designDocs: this.data.designDocs
+      };
+
+      return this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
+        database: database,
+        collection: indexedDocs,
+        nestedView: Documents.Views.Row,
+        viewList: true,
+        ddocInfo: ddocInfo,
+        docParams: docParams,
+        params: urlParams
+      }));
+    },
+
     newViewEditor: function () {
       var params = app.getParams();
 
@@ -347,6 +357,15 @@ function(app, FauxtonAPI, Documents, Databases) {
           params: docParams
         });
 
+        if (!this.documentsView) {
+          this.documentsView = this.createViewDocumentsView(
+            ddoc,
+            docParams, 
+            urlParams,
+            this.data.database,
+            this.indexedDocs,
+            this.data.designDocs);
+        }
       }
 
       this.documentsView.setCollection(collection);

http://git-wip-us.apache.org/repos/asf/couchdb/blob/860eba7c/src/fauxton/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index 48075e8..56e9911 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -1639,6 +1639,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
       if(this.ddocInfoView){
         this.ddocInfoView.remove();
       } 
+
+      if (this.newView) { return; }
       this.ddocInfoView = this.setView('#ddoc-info', new Views.DdocInfo({model: this.ddocInfo }));
       this.ddocInfoView.render();
 


[02/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Posted by ga...@apache.org.
Fauxton: focus input on doubleclick
Fauxton: hide field if Esc if pressed
Fauxton: fix small typo
Fauxton: save value, when I press Enter


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

Branch: refs/heads/2201-fix-new-view
Commit: e671933c2f4d83735ce918d00d8dfe5c1130f727
Parents: f3ca960
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Wed Mar 12 22:49:35 2014 +0100
Committer: suelockwood <de...@apache.org>
Committed: Thu Mar 13 10:43:23 2014 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/config/resources.js      | 31 ++++++++++++++++----
 .../app/addons/config/tests/resourcesSpec.js    | 29 +++++++++++++++++-
 src/fauxton/app/core/tests/layoutSpec.js        |  2 +-
 3 files changed, 55 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/e671933c/src/fauxton/app/addons/config/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/resources.js b/src/fauxton/app/addons/config/resources.js
index 8f9ab08..e5ebe65 100644
--- a/src/fauxton/app/addons/config/resources.js
+++ b/src/fauxton/app/addons/config/resources.js
@@ -22,7 +22,7 @@ function (app, FauxtonAPI) {
   Config.Model = Backbone.Model.extend({});
   Config.OptionModel = Backbone.Model.extend({
     documentation: "config",
-    
+
     url: function () {
       return app.host + '/_config/' + this.get("section") + '/' + this.get("name");
     },
@@ -84,7 +84,8 @@ function (app, FauxtonAPI) {
       "dblclick .js-edit-value": "editValue",
       "click .js-delete-value": "deleteValue",
       "click .js-cancel-value": "cancelEdit",
-      "click .js-save-value": "saveValue"
+      "click .js-save-value": "saveValue",
+      "keyup .js-value-input": "processKeyEvents"
     },
 
     deleteValue: function (event) {
@@ -99,20 +100,40 @@ function (app, FauxtonAPI) {
     editValue: function (event) {
       this.$(".js-show-value").addClass("js-hidden");
       this.$(".js-edit-value-form").removeClass("js-hidden");
+      this.$(".js-value-input").focus();
+    },
+
+    processKeyEvents: function (event) {
+      // Enter key
+      if (event.keyCode === 13) {
+        return this.saveAndRender();
+      }
+      // Esc key
+      if (event.keyCode === 27) {
+        return this.discardValue();
+      }
     },
 
     saveValue: function (event) {
-      this.model.save({value: this.$(".js-value-input").val()});
-      this.render();
+      this.saveAndRender();
     },
 
-    cancelEdit: function (event) {
+    discardValue: function (event) {
       this.$(".js-edit-value-form").addClass("js-hidden");
       this.$(".js-show-value").removeClass("js-hidden");
     },
 
+    cancelEdit: function (event) {
+      this.discardValue();
+    },
+
     serialize: function () {
       return {option: this.model.toJSON()};
+    },
+
+    saveAndRender: function () {
+      this.model.save({value: this.$(".js-value-input").val()});
+      this.render();
     }
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e671933c/src/fauxton/app/addons/config/tests/resourcesSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/tests/resourcesSpec.js b/src/fauxton/app/addons/config/tests/resourcesSpec.js
index 98f6569..b9b8d09 100644
--- a/src/fauxton/app/addons/config/tests/resourcesSpec.js
+++ b/src/fauxton/app/addons/config/tests/resourcesSpec.js
@@ -17,7 +17,7 @@ define([
   var assert = testUtils.assert,
       ViewSandbox = testUtils.ViewSandbox;
 
-  describe("ViewItem", function () {
+  describe("Config: ViewItem", function () {
     var tabMenu, optionModel;
 
     beforeEach(function () {
@@ -52,6 +52,33 @@ define([
         assert.ok(renderSpy.calledOnce);
         assert.ok(saveSpy.calledOnce);
       });
+
+      it("pressing enter should save the model and render", function () {
+        var renderSpy = sinon.stub(tabMenu, 'render');
+        var saveSpy = sinon.stub(optionModel, 'save');
+
+        var e = $.Event("keyup");
+        e.keyCode = 13;
+        tabMenu.$('.js-value-input').trigger(e);
+
+        assert.ok(renderSpy.calledOnce);
+        assert.ok(saveSpy.calledOnce);
+      });
+
+      it("pressing Esc hides the field", function () {
+        var e = $.Event("keyup");
+        e.keyCode = 27;
+        tabMenu.$('.js-value-input').trigger(e);
+
+        assert.ok(tabMenu.$('.js-edit-value-form').hasClass('js-hidden'));
+      });
+
+      it("pressing Cancel hides the field", function () {
+        tabMenu.$('.js-edit-value').trigger('dblclick');
+        tabMenu.$('.js-cancel-value').trigger('click');
+
+        assert.ok(tabMenu.$('.js-edit-value-form').hasClass('js-hidden'));
+      });
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e671933c/src/fauxton/app/core/tests/layoutSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/core/tests/layoutSpec.js b/src/fauxton/app/core/tests/layoutSpec.js
index b58966b..40b1947 100644
--- a/src/fauxton/app/core/tests/layoutSpec.js
+++ b/src/fauxton/app/core/tests/layoutSpec.js
@@ -15,7 +15,7 @@ define([
 ], function (FauxtonAPI, testUtils) {
   var assert = testUtils.assert;
 
-  describe("Faxuton Layout", function () {
+  describe("Fauxton Layout", function () {
     var layout;
 
     beforeEach(function () {


[04/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Posted by ga...@apache.org.
Fauxton: use class instead of inline-style


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

Branch: refs/heads/2201-fix-new-view
Commit: a07924df35f9bc9c555f2a49b1b84d174896e5b1
Parents: b4332e4
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Tue Mar 11 19:24:10 2014 +0100
Committer: suelockwood <de...@apache.org>
Committed: Thu Mar 13 10:43:23 2014 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/config/assets/less/config.less | 3 +++
 src/fauxton/app/addons/config/resources.js            | 8 ++++----
 src/fauxton/app/addons/config/templates/item.html     | 4 ++--
 3 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/a07924df/src/fauxton/app/addons/config/assets/less/config.less
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/assets/less/config.less b/src/fauxton/app/addons/config/assets/less/config.less
index 651cbe3..44311de 100644
--- a/src/fauxton/app/addons/config/assets/less/config.less
+++ b/src/fauxton/app/addons/config/assets/less/config.less
@@ -21,6 +21,9 @@
   .js-delete-value {
     cursor: pointer;
   }
+  .js-hidden {
+    display: none;
+  }
   button {width: 7%;}
 }
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/a07924df/src/fauxton/app/addons/config/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/resources.js b/src/fauxton/app/addons/config/resources.js
index b5c0b6c..8f9ab08 100644
--- a/src/fauxton/app/addons/config/resources.js
+++ b/src/fauxton/app/addons/config/resources.js
@@ -97,8 +97,8 @@ function (app, FauxtonAPI) {
     },
 
     editValue: function (event) {
-      this.$(".js-show-value").hide();
-      this.$(".js-edit-value-form").show();
+      this.$(".js-show-value").addClass("js-hidden");
+      this.$(".js-edit-value-form").removeClass("js-hidden");
     },
 
     saveValue: function (event) {
@@ -107,8 +107,8 @@ function (app, FauxtonAPI) {
     },
 
     cancelEdit: function (event) {
-      this.$(".js-edit-value-form").hide();
-      this.$(".js-show-value").show();
+      this.$(".js-edit-value-form").addClass("js-hidden");
+      this.$(".js-show-value").removeClass("js-hidden");
     },
 
     serialize: function () {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/a07924df/src/fauxton/app/addons/config/templates/item.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/templates/item.html b/src/fauxton/app/addons/config/templates/item.html
index a628fe6..108fa58 100644
--- a/src/fauxton/app/addons/config/templates/item.html
+++ b/src/fauxton/app/addons/config/templates/item.html
@@ -20,9 +20,9 @@ the License.
 <td > <%= option.name %> </td>
 <td class="js-edit-value">
   <div class="js-show-value">
-    <%= option.value %> 
+    <%= option.value %>
   </div>
-  <div class="js-edit-value-form" style="display:none">
+  <div class="js-edit-value-form js-hidden">
     <input class="js-value-input" type="text" value="<%- option.value %>" />
     <button class="js-save-value btn btn-success fonticon-circle-check btn-small"> </button>
     <button class="js-cancel-value btn btn-small fonticon-circle-x"> </button>


[07/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Posted by ga...@apache.org.
Fauxton: remove template files we no longer use


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

Branch: refs/heads/2201-fix-new-view
Commit: 4f7cb15959898e202fa3780d3bcf35a78e297fbc
Parents: e01079c
Author: Garren Smith <ga...@gmail.com>
Authored: Thu Mar 13 13:24:49 2014 -0400
Committer: Garren Smith <ga...@gmail.com>
Committed: Thu Mar 13 13:25:12 2014 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/fauxton/base.js          | 10 +--
 src/fauxton/app/addons/fauxton/components.js    |  4 +-
 src/fauxton/app/templates/fauxton/api_bar.html  | 30 --------
 .../app/templates/fauxton/breadcrumbs.html      | 24 -------
 src/fauxton/app/templates/fauxton/footer.html   | 15 ----
 .../app/templates/fauxton/index_pagination.html | 24 -------
 src/fauxton/app/templates/fauxton/nav_bar.html  | 75 --------------------
 .../app/templates/fauxton/notification.html     | 18 -----
 .../app/templates/fauxton/pagination.html       | 31 --------
 9 files changed, 7 insertions(+), 224 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/4f7cb159/src/fauxton/app/addons/fauxton/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/fauxton/base.js b/src/fauxton/app/addons/fauxton/base.js
index a6e462a..7c50211 100644
--- a/src/fauxton/app/addons/fauxton/base.js
+++ b/src/fauxton/app/addons/fauxton/base.js
@@ -93,7 +93,7 @@ function(app, FauxtonAPI, resizeColumns) {
   };
 
   Fauxton.Breadcrumbs = FauxtonAPI.View.extend({
-    template: "templates/fauxton/breadcrumbs",
+    template: "addons/fauxton/templates/breadcrumbs",
 
     serialize: function() {
       var crumbs = _.clone(this.crumbs);
@@ -114,7 +114,7 @@ function(app, FauxtonAPI, resizeColumns) {
   });
 
   Fauxton.Footer = FauxtonAPI.View.extend({
-    template: "templates/fauxton/footer",
+    template: "addons/fauxton/templates/footer",
 
     initialize: function() {
       this.versionInfo = new Fauxton.VersionInfo();
@@ -133,7 +133,7 @@ function(app, FauxtonAPI, resizeColumns) {
 
   Fauxton.NavBar = FauxtonAPI.View.extend({
     className:"navbar",
-    template: "templates/fauxton/nav_bar",
+    template: "addons/fauxton/templates/nav_bar",
     // TODO: can we generate this list from the router?
     navLinks: [
       {href:"#/_all_dbs", title:"Databases", icon: "fonticon-database", className: 'databases'}
@@ -257,7 +257,7 @@ function(app, FauxtonAPI, resizeColumns) {
   });
 
   Fauxton.ApiBar = FauxtonAPI.View.extend({
-    template: "templates/fauxton/api_bar",
+    template: "addons/fauxton/templates/api_bar",
     endpoint: '_all_docs',
 
     documentation: 'docs',
@@ -310,7 +310,7 @@ function(app, FauxtonAPI, resizeColumns) {
       this.fade = options.fade === undefined ? true : options.fade;
       this.clear = options.clear;
       this.data = options.data || "";
-      this.template = options.template || "templates/fauxton/notification";
+      this.template = options.template || "addons/fauxton/templates/notification";
     },
 
     serialize: function() {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4f7cb159/src/fauxton/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/fauxton/components.js b/src/fauxton/app/addons/fauxton/components.js
index 7dcf2d7..96af169 100644
--- a/src/fauxton/app/addons/fauxton/components.js
+++ b/src/fauxton/app/addons/fauxton/components.js
@@ -32,7 +32,7 @@ function(app, FauxtonAPI, ace, spin) {
   var Components = FauxtonAPI.addon();
 
   Components.Pagination = FauxtonAPI.View.extend({
-    template: "templates/fauxton/pagination",
+    template: "addons/fauxton/templates/pagination",
 
     initialize: function(options) {
       this.page = parseInt(options.page, 10);
@@ -54,7 +54,7 @@ function(app, FauxtonAPI, ace, spin) {
   });
 
   Components.IndexPagination = FauxtonAPI.View.extend({
-    template: "templates/fauxton/index_pagination",
+    template: "addons/fauxton/templates/index_pagination",
     events: {
       "click a": 'scrollTo',
       "click a#next": 'nextClicked',

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4f7cb159/src/fauxton/app/templates/fauxton/api_bar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/api_bar.html b/src/fauxton/app/templates/fauxton/api_bar.html
deleted file mode 100644
index 4fb5971..0000000
--- a/src/fauxton/app/templates/fauxton/api_bar.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-
-<button class="btn btn-primary pull-right api-url-btn">
-  API URL 
-  <i class="fonticon-plus icon"></i>
-</button>
-<div class="api-navbar" style="display: none">
-    <div class="input-prepend input-append">
-      <span class="add-on">
-        API reference
-        <a href="<%=getDocUrl(documentation)%>" target="_blank">
-          <i class="icon-question-sign"></i>
-        </a>
-      </span>
-      <input type="text" class="input-xxlarge" value="<%= endpoint %>">
-      <a href="<%= endpoint %>" target="_blank" class="btn">Show me</a>
-    </div>
-</div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4f7cb159/src/fauxton/app/templates/fauxton/breadcrumbs.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/breadcrumbs.html b/src/fauxton/app/templates/fauxton/breadcrumbs.html
deleted file mode 100644
index 34c4136..0000000
--- a/src/fauxton/app/templates/fauxton/breadcrumbs.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-
-<ul class="breadcrumb">
-  <% _.each(_.initial(crumbs), function(crumb) { %>
-    <li>
-      <a href="#<%= crumb.link %>"><%= crumb.name %></a>
-      <i class="divider fonticon fonticon-carrot"> </i>
-    </li>
-  <% }); %>
-  <% var last = _.last(crumbs) || {name: ''} %>
-  <li class="active"><%= last.name %></li>
-</ul>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4f7cb159/src/fauxton/app/templates/fauxton/footer.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/footer.html b/src/fauxton/app/templates/fauxton/footer.html
deleted file mode 100644
index 593c11f..0000000
--- a/src/fauxton/app/templates/fauxton/footer.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!--
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-
-<p>Fauxton on <a href="http://couchdb.apache.org/">Apache CouchDB</a> <%=version%></p>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4f7cb159/src/fauxton/app/templates/fauxton/index_pagination.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/index_pagination.html b/src/fauxton/app/templates/fauxton/index_pagination.html
deleted file mode 100644
index f445377..0000000
--- a/src/fauxton/app/templates/fauxton/index_pagination.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-
-<div class="pagination pagination-centered">
-  <ul>
-    <li <% if (!canShowPreviousfn()) {%> class="disabled" <% } %>>
-       <a id="previous" href="#"> Previous </a>
-     </li>
-     <li <% if (!canShowNextfn()) {%> class="disabled" <% } %>>
-       <a id="next" href="#"> Next </a></li>
-  </ul>
-</div>
-

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4f7cb159/src/fauxton/app/templates/fauxton/nav_bar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/nav_bar.html b/src/fauxton/app/templates/fauxton/nav_bar.html
deleted file mode 100644
index 9ba24f4..0000000
--- a/src/fauxton/app/templates/fauxton/nav_bar.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!--
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-
-<div class="brand">
-  <div class="burger">
-    <div><!-- * --></div>
-    <div><!-- * --></div>
-    <div><!-- * --></div>
-  </div>
-  <div class="icon">Apache Fauxton</div>
-</div>
-
-<nav id="main_navigation">
-  <ul id="nav-links" class="nav pull-right">
-    <% _.each(navLinks, function(link) { %>
-    <% if (link.view) {return;}  %>
-        <li data-nav-name= "<%= link.title %>" >
-          <a href="<%= link.href %>">
-            <i class="<%= link.icon %> fonticon"></i>
-            <%= link.title %>
-          </a>
-        </li>
-    <% }); %>
-  </ul>
-
-  <div id="footer-links">
-
-    <ul id="bottom-nav-links" class="nav">
-        <li data-nav-name= "Documentation">
-            <a href="<%=getDocUrl('docs')%>" target="_blank">
-              <i class="fonticon-bookmark fonticon"></i>
-                Documentation
-            </a>
-        </li>
-
-
-      <% _.each(bottomNavLinks, function(link) { %>
-      <% if (link.view) {return;}  %>
-        <li data-nav-name= "<%= link.title %>">
-            <a href="<%= link.href %>">
-              <i class="<%= link.icon %> fonticon"></i>
-              <%= link.title %>
-            </a>
-        </li>
-      <% }); %>
-    </ul>
-
-    <ul id="footer-nav-links" class="nav">
-      <% _.each(footerNavLinks, function(link) { %>
-      <% if (link.view) {return;}  %>
-        <li data-nav-name= "<%= link.title %>">
-            <a href="<%= link.href %>">
-              <i class="<%= link.icon %> fonticon"></i>
-              <%= link.title %>
-            </a>
-        </li>
-      <% }); %>
-    </ul>
-
-  </div>
-</nav>
-
-
-

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4f7cb159/src/fauxton/app/templates/fauxton/notification.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/notification.html b/src/fauxton/app/templates/fauxton/notification.html
deleted file mode 100644
index ca8a903..0000000
--- a/src/fauxton/app/templates/fauxton/notification.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!--
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-
-<div class="alert alert-<%= type %>">
-  <button type="button" class="close" data-dismiss="alert">×</button>
-  <%= msg %>
-</div>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4f7cb159/src/fauxton/app/templates/fauxton/pagination.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/pagination.html b/src/fauxton/app/templates/fauxton/pagination.html
deleted file mode 100644
index 19dfc8c..0000000
--- a/src/fauxton/app/templates/fauxton/pagination.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-
-<div class="pagination pagination-centered">
-  <ul>
-    <% if (page > 1) { %>
-    <li> <a href="<%= urlFun(page-1) %>">&laquo;</a></li>
-    <% } else { %>
-      <li class="disabled"> <a href="<%= urlFun(page) %>">&laquo;</a></li>
-    <% } %>
-    <% _.each(_.range(1, totalPages+1), function(i) { %>
-      <li <% if (page == i) { %>class="active"<% } %>> <a href="<%= urlFun(i) %>"><%= i %></a></li>
-    <% }) %>
-    <% if (page < totalPages) { %>
-      <li><a href="<%= urlFun(page+1) %>">&raquo;</a></li>
-    <% } else { %>
-      <li class="disabled"> <a href="<%= urlFun(page) %>">&raquo;</a></li>
-    <% } %>
-  </ul>
-</div>


[05/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Posted by ga...@apache.org.
Fauxton: Config removed redundant method.


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

Branch: refs/heads/2201-fix-new-view
Commit: 4913c6e07b47755b7116aabcfec3d529f8ad32c4
Parents: e671933
Author: suelockwood <de...@apache.org>
Authored: Thu Mar 13 10:45:27 2014 -0400
Committer: suelockwood <de...@apache.org>
Committed: Thu Mar 13 10:45:27 2014 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/config/resources.js | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/4913c6e0/src/fauxton/app/addons/config/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/resources.js b/src/fauxton/app/addons/config/resources.js
index e5ebe65..c0e103a 100644
--- a/src/fauxton/app/addons/config/resources.js
+++ b/src/fauxton/app/addons/config/resources.js
@@ -84,7 +84,7 @@ function (app, FauxtonAPI) {
       "dblclick .js-edit-value": "editValue",
       "click .js-delete-value": "deleteValue",
       "click .js-cancel-value": "cancelEdit",
-      "click .js-save-value": "saveValue",
+      "click .js-save-value": "saveAndRender",
       "keyup .js-value-input": "processKeyEvents"
     },
 
@@ -114,9 +114,6 @@ function (app, FauxtonAPI) {
       }
     },
 
-    saveValue: function (event) {
-      this.saveAndRender();
-    },
 
     discardValue: function (event) {
       this.$(".js-edit-value-form").addClass("js-hidden");


[09/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Posted by ga...@apache.org.
assign design doc correctly


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

Branch: refs/heads/2201-fix-new-view
Commit: 0f4b7c65b23725d6f691e92d8053997b13758f8b
Parents: 860eba7
Author: Garren Smith <ga...@gmail.com>
Authored: Thu Mar 13 12:06:55 2014 -0400
Committer: Garren Smith <ga...@gmail.com>
Committed: Thu Mar 13 13:25:33 2014 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/documents/routes.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/0f4b7c65/src/fauxton/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js
index 67589d4..c7730df 100644
--- a/src/fauxton/app/addons/documents/routes.js
+++ b/src/fauxton/app/addons/documents/routes.js
@@ -294,7 +294,7 @@ function(app, FauxtonAPI, Documents, Databases) {
 
     createViewDocumentsView: function (designDoc, docParams, urlParams, database, indexedDocs, designDocs) {
        var ddocInfo = {
-        id: "_design/" + designDocs,
+        id: "_design/" + designDoc,
         currView: view,
         designDocs: this.data.designDocs
       };


[06/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Posted by ga...@apache.org.
Config refactor-  Move views into their own file and out of resources.


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

Branch: refs/heads/2201-fix-new-view
Commit: e01079ccbeb01f6fa702af239f9af8969ffbce4a
Parents: 4913c6e
Author: suelockwood <de...@apache.org>
Authored: Thu Mar 13 12:01:39 2014 -0400
Committer: suelockwood <de...@apache.org>
Committed: Thu Mar 13 12:01:39 2014 -0400

----------------------------------------------------------------------
 src/Makefile.am                                 |   1 +
 src/fauxton/app/addons/config/base.js           |   6 +-
 src/fauxton/app/addons/config/resources.js      | 120 ----------------
 src/fauxton/app/addons/config/routes.js         |   7 +-
 .../app/addons/config/tests/resourcesSpec.js    |   7 +-
 src/fauxton/app/addons/config/views.js          | 144 +++++++++++++++++++
 6 files changed, 157 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/e01079cc/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index a213baa..a5eea39 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -68,6 +68,7 @@ FAUXTON_FILES = \
     fauxton/app/addons/compaction/views.js \
     fauxton/app/addons/config/base.js \
     fauxton/app/addons/config/resources.js \
+    fauxton/app/addons/config/views.js \
     fauxton/app/addons/config/routes.js \
     fauxton/app/addons/config/templates/dashboard.html \
     fauxton/app/addons/config/templates/item.html \

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e01079cc/src/fauxton/app/addons/config/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/base.js b/src/fauxton/app/addons/config/base.js
index 8362cb5..589cb14 100644
--- a/src/fauxton/app/addons/config/base.js
+++ b/src/fauxton/app/addons/config/base.js
@@ -16,10 +16,12 @@ define([
   "api",
 
   // Modules
-  "addons/config/routes"
+  "addons/config/routes",
+  "addons/config/views"
 ],
 
-function(app, FauxtonAPI, Config) {
+function(app, FauxtonAPI, Config, Views) {
+	Config.Views = Views;
   Config.initialize = function() {
     FauxtonAPI.addHeaderLink({title: "Config", href: "#_config", icon:"fonticon-cog", className: 'config'});
   };

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e01079cc/src/fauxton/app/addons/config/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/resources.js b/src/fauxton/app/addons/config/resources.js
index c0e103a..ec8cc98 100644
--- a/src/fauxton/app/addons/config/resources.js
+++ b/src/fauxton/app/addons/config/resources.js
@@ -75,125 +75,5 @@ function (app, FauxtonAPI) {
     }
   });
 
-  Config.ViewItem = FauxtonAPI.View.extend({
-    tagName: "tr",
-    className: "config-item",
-    template: "addons/config/templates/item",
-
-    events: {
-      "dblclick .js-edit-value": "editValue",
-      "click .js-delete-value": "deleteValue",
-      "click .js-cancel-value": "cancelEdit",
-      "click .js-save-value": "saveAndRender",
-      "keyup .js-value-input": "processKeyEvents"
-    },
-
-    deleteValue: function (event) {
-      var result = confirm("Are you sure you want to delete this configuration value?");
-
-      if (!result) { return; }
-
-      this.model.destroy();
-      this.remove();
-    },
-
-    editValue: function (event) {
-      this.$(".js-show-value").addClass("js-hidden");
-      this.$(".js-edit-value-form").removeClass("js-hidden");
-      this.$(".js-value-input").focus();
-    },
-
-    processKeyEvents: function (event) {
-      // Enter key
-      if (event.keyCode === 13) {
-        return this.saveAndRender();
-      }
-      // Esc key
-      if (event.keyCode === 27) {
-        return this.discardValue();
-      }
-    },
-
-
-    discardValue: function (event) {
-      this.$(".js-edit-value-form").addClass("js-hidden");
-      this.$(".js-show-value").removeClass("js-hidden");
-    },
-
-    cancelEdit: function (event) {
-      this.discardValue();
-    },
-
-    serialize: function () {
-      return {option: this.model.toJSON()};
-    },
-
-    saveAndRender: function () {
-      this.model.save({value: this.$(".js-value-input").val()});
-      this.render();
-    }
-
-  });
-
-  Config.View = FauxtonAPI.View.extend({
-    template: "addons/config/templates/dashboard",
-
-    events: {
-      "click #add-section": "addSection",
-      "submit #add-section-form": "submitForm"
-    },
-
-    submitForm: function (event) {
-      event.preventDefault();
-      var option = new Config.OptionModel({
-        section: this.$('input[name="section"]').val(),
-        name: this.$('input[name="name"]').val(),
-        value: this.$('input[name="value"]').val()
-      });
-
-      option.save();
-
-      var section = this.collection.find(function (section) {
-        return section.get("section") === option.get("section");
-      });
-
-      if (section) {
-        section.get("options").push(option.attributes);
-      } else {
-        this.collection.add({
-          section: option.get("section"),
-          options: [option.attributes]
-        });
-      }
-
-      this.$("#add-section-modal").modal('hide');
-      this.render();
-    },
-
-    addSection: function (event) {
-      event.preventDefault();
-      this.$("#add-section-modal").modal({show:true});
-    },
-
-    beforeRender: function() {
-      this.collection.each(function(config) {
-        _.each(config.get("options"), function (option, index) {
-          this.insertView("table.config tbody", new Config.ViewItem({
-            model: new Config.OptionModel({
-              section: config.get("section"),
-              name: option.name,
-              value: option.value,
-              index: index
-            })
-          }));
-        }, this);
-      }, this);
-    },
-
-    establish: function() {
-      return [this.collection.fetch()];
-    }
-  });
-
   return Config;
 });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e01079cc/src/fauxton/app/addons/config/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/routes.js b/src/fauxton/app/addons/config/routes.js
index 6af8157..519e25f 100644
--- a/src/fauxton/app/addons/config/routes.js
+++ b/src/fauxton/app/addons/config/routes.js
@@ -16,10 +16,11 @@ define([
        "api",
 
        // Modules
-       "addons/config/resources"
+       "addons/config/resources",
+       "addons/config/views"
 ],
 
-function(app, FauxtonAPI, Config) {
+function(app, FauxtonAPI, Config, Views) {
 
   var ConfigRouteObject = FauxtonAPI.RouteObject.extend({
     layout: "one_pane",
@@ -45,7 +46,7 @@ function(app, FauxtonAPI, Config) {
     },
 
     config: function () {
-      this.setView("#dashboard-content", new Config.View({collection: this.configs}));
+      this.setView("#dashboard-content", new Views.Table({collection: this.configs}));
     },
 
     establish: function () {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e01079cc/src/fauxton/app/addons/config/tests/resourcesSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/tests/resourcesSpec.js b/src/fauxton/app/addons/config/tests/resourcesSpec.js
index b9b8d09..c78bc85 100644
--- a/src/fauxton/app/addons/config/tests/resourcesSpec.js
+++ b/src/fauxton/app/addons/config/tests/resourcesSpec.js
@@ -12,12 +12,13 @@
 define([
       'api',
       'addons/config/resources',
+      'addons/config/views',
       'testUtils'
-], function (FauxtonAPI, Resources, testUtils) {
+], function (FauxtonAPI, Resources, Views, testUtils) {
   var assert = testUtils.assert,
       ViewSandbox = testUtils.ViewSandbox;
 
-  describe("Config: ViewItem", function () {
+  describe("Config: TableRow", function () {
     var tabMenu, optionModel;
 
     beforeEach(function () {
@@ -26,7 +27,7 @@ define([
         name: "bar"
       });
 
-      tabMenu = new Resources.ViewItem({
+      tabMenu = new Views.TableRow({
         model: optionModel
       });
     });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e01079cc/src/fauxton/app/addons/config/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/views.js b/src/fauxton/app/addons/config/views.js
new file mode 100644
index 0000000..bd05652
--- /dev/null
+++ b/src/fauxton/app/addons/config/views.js
@@ -0,0 +1,144 @@
+ // Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+  "app",
+  "api",
+  "addons/config/resources",
+],
+
+function (app, FauxtonAPI, Config) {
+
+  var Views = {};
+
+  Views.TableRow = FauxtonAPI.View.extend({
+    tagName: "tr",
+    className: "config-item",
+    template: "addons/config/templates/item",
+
+    events: {
+      "dblclick .js-edit-value": "editValue",
+      "click .js-delete-value": "deleteValue",
+      "click .js-cancel-value": "cancelEdit",
+      "click .js-save-value": "saveAndRender",
+      "keyup .js-value-input": "processKeyEvents"
+    },
+
+    deleteValue: function (event) {
+      var result = confirm("Are you sure you want to delete this configuration value?");
+
+      if (!result) { return; }
+
+      this.model.destroy();
+      this.remove();
+    },
+
+    editValue: function (event) {
+      this.$(".js-show-value").addClass("js-hidden");
+      this.$(".js-edit-value-form").removeClass("js-hidden");
+      this.$(".js-value-input").focus();
+    },
+
+    processKeyEvents: function (event) {
+      // Enter key
+      if (event.keyCode === 13) {
+        return this.saveAndRender();
+      }
+      // Esc key
+      if (event.keyCode === 27) {
+        return this.discardValue();
+      }
+    },
+
+
+    discardValue: function (event) {
+      this.$(".js-edit-value-form").addClass("js-hidden");
+      this.$(".js-show-value").removeClass("js-hidden");
+    },
+
+    cancelEdit: function (event) {
+      this.discardValue();
+    },
+
+    serialize: function () {
+      return {option: this.model.toJSON()};
+    },
+
+    saveAndRender: function () {
+      this.model.save({value: this.$(".js-value-input").val()});
+      this.render();
+    }
+
+  });
+
+  Views.Table = FauxtonAPI.View.extend({
+    template: "addons/config/templates/dashboard",
+
+    events: {
+      "click #add-section": "addSection",
+      "submit #add-section-form": "submitForm"
+    },
+
+    submitForm: function (event) {
+      event.preventDefault();
+      var option = new Config.OptionModel({
+        section: this.$('input[name="section"]').val(),
+        name: this.$('input[name="name"]').val(),
+        value: this.$('input[name="value"]').val()
+      });
+
+      option.save();
+
+      var section = this.collection.find(function (section) {
+        return section.get("section") === option.get("section");
+      });
+
+      if (section) {
+        section.get("options").push(option.attributes);
+      } else {
+        this.collection.add({
+          section: option.get("section"),
+          options: [option.attributes]
+        });
+      }
+
+      this.$("#add-section-modal").modal('hide');
+      this.render();
+    },
+
+    addSection: function (event) {
+      event.preventDefault();
+      this.$("#add-section-modal").modal({show:true});
+    },
+
+    beforeRender: function() {
+      this.collection.each(function(config) {
+        _.each(config.get("options"), function (option, index) {
+          this.insertView("table.config tbody", new Views.TableRow({
+            model: new Config.OptionModel({
+              section: config.get("section"),
+              name: option.name,
+              value: option.value,
+              index: index
+            })
+          }));
+        }, this);
+      }, this);
+    },
+
+    establish: function() {
+      return [this.collection.fetch()];
+    }
+  });
+
+  return Views;
+});


[10/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Posted by ga...@apache.org.
create options argument


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

Branch: refs/heads/2201-fix-new-view
Commit: cc3c373491f4ed0a48412de9136cf6f485dd379d
Parents: 0f4b7c6
Author: Garren Smith <ga...@gmail.com>
Authored: Thu Mar 13 13:51:50 2014 -0400
Committer: Garren Smith <ga...@gmail.com>
Committed: Thu Mar 13 13:51:50 2014 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/documents/routes.js | 53 ++++++++++++++-----------
 1 file changed, 30 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/cc3c3734/src/fauxton/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js
index c7730df..699a496 100644
--- a/src/fauxton/app/addons/documents/routes.js
+++ b/src/fauxton/app/addons/documents/routes.js
@@ -267,18 +267,20 @@ function(app, FauxtonAPI, Documents, Databases) {
         params: urlParams,
         newView: false,
         database: this.data.database,
-        ddocInfo: ddocInfo
+        ddocInfo: this.ddocInfo(decodeDdoc, this.data.designDocs, view)
       }));
 
       if (this.toolsView) { this.toolsView.remove(); }
 
-      this.documentsView = this.createViewDocumentsView(
-        decodeDdoc,
-        docParams, 
-        urlParams,
-        this.data.database,
-        this.indexedDocs,
-        this.data.designDocs);
+      this.documentsView = this.createViewDocumentsView({
+        designDoc: decodeDdoc,
+        docParams: docParams, 
+        urlParams: urlParams,
+        database: this.data.database,
+        indexedDocs: this.data.indexedDocs,
+        designDocs: this.data.designDocs,
+        view: view
+      });
 
       this.sidebar.setSelectedTab(app.utils.removeSpecialCharacters(ddoc) + '_' + app.utils.removeSpecialCharacters(view));
 
@@ -292,21 +294,24 @@ function(app, FauxtonAPI, Documents, Databases) {
       Documents.paginate.reset();
     },
 
-    createViewDocumentsView: function (designDoc, docParams, urlParams, database, indexedDocs, designDocs) {
-       var ddocInfo = {
+    ddocInfo: function (designDoc, designDocs, view) {
+      return {
         id: "_design/" + designDoc,
         currView: view,
-        designDocs: this.data.designDocs
+        designDocs: designDocs
       };
+    },
+
+    createViewDocumentsView: function (options) { 
 
       return this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
-        database: database,
-        collection: indexedDocs,
+        database: options.database,
+        collection: options.indexedDocs,
         nestedView: Documents.Views.Row,
         viewList: true,
-        ddocInfo: ddocInfo,
-        docParams: docParams,
-        params: urlParams
+        ddocInfo: this.ddocInfo(options.designDoc, options.designDocs, options.view),
+        docParams: options.docParams,
+        params: options.urlParams
       }));
     },
 
@@ -358,13 +363,15 @@ function(app, FauxtonAPI, Documents, Databases) {
         });
 
         if (!this.documentsView) {
-          this.documentsView = this.createViewDocumentsView(
-            ddoc,
-            docParams, 
-            urlParams,
-            this.data.database,
-            this.indexedDocs,
-            this.data.designDocs);
+          this.documentsView = this.createViewDocumentsView({
+            designDoc: ddoc,
+            docParams: docParams, 
+            urlParams: urlParams,
+            database: this.data.database,
+            indexedDocs: this.indexedDocs,
+            designDocs: this.data.designDocs,
+            view: view
+          });
         }
       }
 


[03/10] couchdb commit: updated refs/heads/2201-fix-new-view to cc3c373

Posted by ga...@apache.org.
Fauxton: add tests for config


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

Branch: refs/heads/2201-fix-new-view
Commit: f3ca96026a8da409756e30c8cf8efd05968feeab
Parents: a07924d
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Tue Mar 11 19:48:57 2014 +0100
Committer: suelockwood <de...@apache.org>
Committed: Thu Mar 13 10:43:23 2014 -0400

----------------------------------------------------------------------
 src/Makefile.am                                 |  1 +
 .../app/addons/config/tests/resourcesSpec.js    | 57 ++++++++++++++++++++
 2 files changed, 58 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/f3ca9602/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 59aa6bf..a213baa 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -71,6 +71,7 @@ FAUXTON_FILES = \
     fauxton/app/addons/config/routes.js \
     fauxton/app/addons/config/templates/dashboard.html \
     fauxton/app/addons/config/templates/item.html \
+    fauxton/app/addons/config/tests/resourcesSpec.js \
     fauxton/app/addons/contribute/base.js \
     fauxton/app/addons/exampleAuth/base.js \
     fauxton/app/addons/exampleAuth/templates/noAccess.html \

http://git-wip-us.apache.org/repos/asf/couchdb/blob/f3ca9602/src/fauxton/app/addons/config/tests/resourcesSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/tests/resourcesSpec.js b/src/fauxton/app/addons/config/tests/resourcesSpec.js
new file mode 100644
index 0000000..98f6569
--- /dev/null
+++ b/src/fauxton/app/addons/config/tests/resourcesSpec.js
@@ -0,0 +1,57 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+define([
+      'api',
+      'addons/config/resources',
+      'testUtils'
+], function (FauxtonAPI, Resources, testUtils) {
+  var assert = testUtils.assert,
+      ViewSandbox = testUtils.ViewSandbox;
+
+  describe("ViewItem", function () {
+    var tabMenu, optionModel;
+
+    beforeEach(function () {
+      optionModel = new Resources.OptionModel({
+        section: "foo",
+        name: "bar"
+      });
+
+      tabMenu = new Resources.ViewItem({
+        model: optionModel
+      });
+    });
+
+    describe("editing Items", function () {
+      var viewSandbox;
+      beforeEach(function () {
+        viewSandbox = new ViewSandbox();
+        viewSandbox.renderView(tabMenu);
+      });
+
+      afterEach(function () {
+        viewSandbox.remove();
+      });
+
+      it("click on save should save the model and render", function () {
+        var renderSpy = sinon.stub(tabMenu, 'render');
+        var saveSpy = sinon.stub(optionModel, 'save');
+
+        tabMenu.$('.js-edit-value').trigger('dblclick');
+        tabMenu.$('.js-save-value').trigger('click');
+
+        assert.ok(renderSpy.calledOnce);
+        assert.ok(saveSpy.calledOnce);
+      });
+    });
+  });
+});