Fix sidebar for new views that have odd characters

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

Branch: refs/heads/api-options
Commit: 65c1b9993c0108e09e3b32303dc3b9bf69573ff6
Parents: b9a87c8
Author: suelockwood <[email protected]>
Authored: Thu Jan 9 10:15:33 2014 -0500
Committer: suelockwood <[email protected]>
Committed: Thu Jan 9 10:15:33 2014 -0500

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/65c1b999/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 05c86f8..c3f96b7 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -1535,7 +1535,8 @@ function(app, FauxtonAPI, Components, Documents, 
Databases, pouchdb, resizeColum
         }
         this.ddocID = this.model.id;
       } else {
-        this.model = this.ddocs.get(this.ddocID).dDocModel();
+        var ddocDecode = decodeURIComponent(this.ddocID);
+        this.model = this.ddocs.get(ddocDecode).dDocModel();
         this.reduceFunStr = this.model.viewHasReduce(this.viewName);
         this.setView('#ddoc-info', new Views.DdocInfo({model: this.ddocInfo 
}));
       }
@@ -1717,10 +1718,26 @@ function(app, FauxtonAPI, Components, Documents, 
Databases, pouchdb, resizeColum
       }, this);
     },
 
+    addNewSidebarItem: function(key, selector, design){
+      console.log(args, "sidebarupdate");
+      // var selected = this.ddocID == "_design/"+design;
+      // var view = this.insertView("ul.nav.views", new Views.IndexItem({
+      //     ddoc: design,
+      //     index: key,
+      //     database: this.collection.database.id,
+      //     selected: selected && key == this.currView
+      //   }));
+      // if (render !== false) {
+      //   view.render();
+      // }
+    },
+
     afterRender: function () {
       if (this.selectedTab) {
         this.setSelectedTab(this.selectedTab);
       }
+
+      this.listenTo(this.collection, "add", this.addNewSidebarItem);
     },
 
     setSelectedTab: function (selectedTab) {

Reply via email to