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/01/22 15:49:04 UTC

[22/50] [abbrv] couchdb commit: updated refs/heads/api-options to bd721a5

Regex fix for creating (from duplicate)  Design docs and deleting weirdly encoded docs what begin with _design


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

Branch: refs/heads/api-options
Commit: 2e4d72bd66a5c0bf2e1779178ce9855870a9ffd5
Parents: 86b6a14
Author: suelockwood <de...@apache.org>
Authored: Mon Jan 13 12:05:24 2014 -0500
Committer: suelockwood <de...@apache.org>
Committed: Mon Jan 13 12:05:24 2014 -0500

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


http://git-wip-us.apache.org/repos/asf/couchdb/blob/2e4d72bd/src/fauxton/app/addons/documents/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/resources.js b/src/fauxton/app/addons/documents/resources.js
index 5e10ded..0fd99f1 100644
--- a/src/fauxton/app/addons/documents/resources.js
+++ b/src/fauxton/app/addons/documents/resources.js
@@ -56,7 +56,7 @@ function(app, FauxtonAPI) {
     },
 
     docType: function() {
-      return this.id.match(/^_design/) ? "design doc" : "doc";
+      return this.id && this.id.match(/^_design\//) ? "design doc" : "doc";
     },
 
     isEditable: function() {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/2e4d72bd/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 94332a2..2502b58 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -242,7 +242,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
     duplicate: function (event) {
       event.preventDefault();
       var newId = this.$('#dup-id').val(),
-          encodedID = app.utils.safeURLName(newId);
+          isDDoc = newId.match(/^_design\//),
+          removeDDocID = newId.replace(/^_design\//,""),
+          encodedID = isDDoc? "_design/"+ app.utils.safeURLName(removeDDocID):app.utils.safeURLName(newId);
 
       this.hideModal();
       FauxtonAPI.triggerRouteEvent('duplicateDoc', encodedID);