You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2015/09/10 19:10:46 UTC

fauxton commit: updated refs/heads/master to 24953b2

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 227e68bc4 -> 24953b293


use FauxtonAPI.url helper

covered by the attachment selenium test

PR: #520
PR-URL: https://github.com/apache/couchdb-fauxton/pull/520
Reviewed-By: Michelle Phung <mi...@apache.org>


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

Branch: refs/heads/master
Commit: 24953b29308682a9832870a9f33a1ad983ff5ca1
Parents: 227e68b
Author: Robert Kowalski <ro...@apache.org>
Authored: Thu Sep 10 17:51:23 2015 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Thu Sep 10 19:10:26 2015 +0200

----------------------------------------------------------------------
 app/addons/documents/base.js               | 6 +++++-
 app/addons/documents/doc-editor/actions.js | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/24953b29/app/addons/documents/base.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/base.js b/app/addons/documents/base.js
index ba4a892..6a76eb1 100644
--- a/app/addons/documents/base.js
+++ b/app/addons/documents/base.js
@@ -69,11 +69,15 @@ function (app, FauxtonAPI, Documents) {
     }
   });
 
-  FauxtonAPI.registerUrls( 'document', {
+  FauxtonAPI.registerUrls('document', {
     server: function (database, doc) {
       return app.host + '/' + database + '/' + doc;
     },
 
+    attachment: function (database, doc, filename, query) {
+      return app.host + '/' + database + '/' + doc + '/' + filename + query;
+    },
+
     app: function (database, doc) {
       return '/database/' + database + '/' + doc;
     },

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/24953b29/app/addons/documents/doc-editor/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/actions.js b/app/addons/documents/doc-editor/actions.js
index 04fc4a9..3d41d0d 100644
--- a/app/addons/documents/doc-editor/actions.js
+++ b/app/addons/documents/doc-editor/actions.js
@@ -141,9 +141,13 @@ function (app, FauxtonAPI, ActionTypes) {
     // store the xhr in parent scope to allow us to cancel any uploads if the user closes the modal
     xhr = $.ajaxSettings.xhr();
 
+    var query = '?rev=' + params.rev;
+    var db = params.doc.getDatabase().safeID();
+    var docId = params.doc.safeID();
     var file = params.files[0];
+
     $.ajax({
-      url: params.doc.url() + '/' + file.name + '?rev=' + params.rev,
+      url: FauxtonAPI.urls('document', 'attachment', db, docId, file.name, query),
       type: 'PUT',
       data: file,
       contentType: file.type,