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/09/03 16:05:24 UTC

[4/4] fauxton commit: updated refs/heads/master to 7eca51c

Bug fixes on creating/editing views


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

Branch: refs/heads/master
Commit: 7eca51c37b8053037422a06152ea6fabc1b30b7b
Parents: feb8907
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Sep 3 15:19:12 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Sep 3 16:05:07 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/routes-documents.js | 11 ++++++-----
 app/addons/documents/views-index.js      |  3 +--
 app/addons/documents/views-sidebar.js    | 19 ++++++++++++++-----
 app/addons/documents/views.js            |  7 ++++---
 app/addons/fauxton/tests/paginateSpec.js |  4 ++++
 5 files changed, 29 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7eca51c3/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js
index 9c466a0..534889c 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -344,11 +344,9 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases, Resou
       }));
 
       this.sidebar.setSelectedTab('new-view');
-      this.crumbs = function () {
-        return [
-          {"name": this.database.id, "link": Databases.databaseUrl(this.database)},
-        ];
-      };
+
+      //this.rightHeader.updateApiUrl([this.indexedDocs.urlRef("apiurl", urlParams), "docs"]);
+      this.leftheader.forceRender();
     },
 
     updateAllDocsFromView: function (event) {
@@ -407,18 +405,21 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases, Resou
       this.documentsView.forceRender();
       this.documentsView.collection.pageSizeReset(perPage, {fetch: false});
       this.setDocPerPageLimit(perPage);
+      this.leftheader.forceRender();
     },
 
     paginate: function (options) {
       var collection = this.documentsView.collection;
 
       this.documentsView.forceRender();
+      this.leftheader.forceRender();
       collection.paging.pageSize = options.perPage;
       var promise = collection[options.direction]({fetch: false});
     },
 
     reloadDesignDocs: function (event) {
       this.sidebar.forceRender();
+      this.leftheader.forceRender();
 
       if (event && event.selectedTab) {
         this.sidebar.setSelectedTab(event.selectedTab);

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7eca51c3/app/addons/documents/views-index.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-index.js b/app/addons/documents/views-index.js
index d0ed8ed..a21dc61 100644
--- a/app/addons/documents/views-index.js
+++ b/app/addons/documents/views-index.js
@@ -168,7 +168,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
           that.mapEditor.editSaved();
           that.reduceEditor && that.reduceEditor.editSaved();
 
-
           FauxtonAPI.addNotification({
             msg: "View has been saved.",
             type: "success",
@@ -177,7 +176,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
           });
 
           if (that.newView || viewNameChange) {
-            var fragment = '/database/' + that.database.safeID() +'/' + ddoc.safeID() + '/_view/' + app.utils.safeURLName(viewName);
+            var fragment = '/database/' + that.database.safeID() +'/' + ddoc.safeID() + '/_views/' + app.utils.safeURLName(viewName);
 
             FauxtonAPI.navigate(fragment, {trigger: false});
             that.newView = false;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7eca51c3/app/addons/documents/views-sidebar.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-sidebar.js b/app/addons/documents/views-sidebar.js
index 9f8c0ee..34212ef 100644
--- a/app/addons/documents/views-sidebar.js
+++ b/app/addons/documents/views-sidebar.js
@@ -37,6 +37,8 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
         this.ddocID = options.ddocInfo.id;
         this.currView = options.ddocInfo.currView;
       }
+
+      this.designDocList = [];
     },
     showDeleteDatabaseModal: function(event){
       this.deleteDBModal.showModal();
@@ -105,12 +107,18 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
         links: newLinks,
       }));
 
+      _.each(this.designDocList, function (view) { view.remove();});
+      this.designDocList = [];
+
       this.collection.each(function(design) {
         if (design.has('doc')){
-          this.insertView(new Views.DdocSidenav({
+          design.collection = this.collection;
+          var view = this.insertView(new Views.DdocSidenav({
             model: design,
             collection: this.collection
           }));
+
+          this.designDocList.push(view);
         }
       },this);
     },
@@ -151,15 +159,16 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
     toggleArrow:  function(e){
       this.$(e.currentTarget).toggleClass("down");
     },
-    buildIndexList: function(collection, info){
+    buildIndexList: function(designDocs, info){
       var design = this.model.id.replace(/^_design\//,"");
+      var databaseId = this.model.database.id;
 
       this.insertView(".accordion-body", new Views.IndexItem({
         selector: info.selector,
         ddoc: design,
-        collection: collection[info.selector],
+        collection: designDocs[info.selector],
         name: info.name,
-        database: this.model.collection.database.id
+        database: databaseId
       }));
     },
 
@@ -170,7 +179,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
         designDoc: ddocName,
         ddoc_clean: app.utils.removeSpecialCharacters(ddocName),
         ddoc_encoded: app.utils.safeURLName(ddocName),
-        database_encoded: app.utils.safeURLName(this.model.collection.database.id),
+        database_encoded: app.utils.safeURLName(this.model.database.id),
       };
     },
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7eca51c3/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 7f44f70..01accb6 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -193,8 +193,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
     }
   });
 
-
-
   Views.Document = FauxtonAPI.View.extend({
     template: "addons/documents/templates/all_docs_item",
     tagName: "tr",
@@ -578,7 +576,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
     serialize: function() {
       return {
         viewList: this.viewList,
-        resizeLayout: this.viewList ? "-half":"",
+        resizeLayout: "", //this.viewList ? "-half":"",
         expandDocs: this.expandDocs,
         endOfResults: !this.pagination.canShowNextfn()
       };
@@ -668,6 +666,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
 
     setCollection: function (collection) {
       this.collection = collection;
+      if (!this.pagination) {
+        this.addPagination();
+      }
       this.pagination.setCollection(collection);
       this.allDocsNumber.setCollection(collection);
     },

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/7eca51c3/app/addons/fauxton/tests/paginateSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/paginateSpec.js b/app/addons/fauxton/tests/paginateSpec.js
index f97b255..460c924 100644
--- a/app/addons/fauxton/tests/paginateSpec.js
+++ b/app/addons/fauxton/tests/paginateSpec.js
@@ -22,6 +22,10 @@ define([
 
   describe('IndexPaginate', function () {
     var viewSandbox, paginate, collection, navigateMock;
+    app.resizeColumns = {
+      onResizeHandler: function () {}
+    };
+
     beforeEach(function (done) {
       collection = new Models.IndexCollection([{
         id:'myId1',