Updated Branches:
  refs/heads/1937-fauxton-proxy [created] 376bde8e4

changing urls to work on proxy


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

Branch: refs/heads/1937-fauxton-proxy
Commit: 376bde8e409e75680610df7daf0c280c9fa59fab
Parents: aefd60e
Author: Garren Smith <[email protected]>
Authored: Thu Nov 21 14:29:22 2013 +0200
Committer: Garren Smith <[email protected]>
Committed: Fri Nov 22 17:02:29 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/auth/resources.js        |  6 +++---
 src/fauxton/app/addons/permissions/resources.js |  2 +-
 .../app/addons/verifyinstall/resources.js       | 11 +++--------
 src/fauxton/app/api.js                          | 20 +++++++++++++++++++-
 src/fauxton/app/app.js                          |  3 ++-
 src/fauxton/app/helpers.js                      |  3 ++-
 src/fauxton/app/modules/databases/resources.js  |  4 ++++
 src/fauxton/app/modules/documents/resources.js  |  2 +-
 8 files changed, 35 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/376bde8e/src/fauxton/app/addons/auth/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/resources.js 
b/src/fauxton/app/addons/auth/resources.js
index b1d40cc..970d55b 100644
--- a/src/fauxton/app/addons/auth/resources.js
+++ b/src/fauxton/app/addons/auth/resources.js
@@ -47,7 +47,7 @@ function (app, FauxtonAPI) {
   });
 
   Auth.Session = FauxtonAPI.Session.extend({
-    url: '/_session',
+    url: app.host + '/_session',
 
     initialize: function (options) {
       if (!options) { options = {}; }
@@ -155,7 +155,7 @@ function (app, FauxtonAPI) {
       return $.ajax({
         cache: false,
         type: "POST", 
-        url: "/_session", 
+        url: app.host + "/_session", 
         dataType: "json",
         data: {name: username, password: password}
       }).then(function () {
@@ -168,7 +168,7 @@ function (app, FauxtonAPI) {
 
       return $.ajax({
         type: "DELETE", 
-        url: "/_session", 
+        url: app.host + "/_session", 
         dataType: "json",
         username : "_", 
         password : "_"

http://git-wip-us.apache.org/repos/asf/couchdb/blob/376bde8e/src/fauxton/app/addons/permissions/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/permissions/resources.js 
b/src/fauxton/app/addons/permissions/resources.js
index 66eaffd..c752684 100644
--- a/src/fauxton/app/addons/permissions/resources.js
+++ b/src/fauxton/app/addons/permissions/resources.js
@@ -39,7 +39,7 @@ function (app, FauxtonAPI ) {
     },
 
     url: function () {
-      return this.database.id + '/_security';
+      return app.host + '/' + this.database.id + '/_security';
     },
 
     addItem: function (value, type, section) {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/376bde8e/src/fauxton/app/addons/verifyinstall/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/verifyinstall/resources.js 
b/src/fauxton/app/addons/verifyinstall/resources.js
index f42c020..d789cf8 100644
--- a/src/fauxton/app/addons/verifyinstall/resources.js
+++ b/src/fauxton/app/addons/verifyinstall/resources.js
@@ -130,7 +130,7 @@ function (app, FauxtonAPI, Databases, Documents) {
 
     setupReplicate: function () {
       return $.ajax({
-        url: '/_replicate',
+        url: app.host + '/_replicate',
         contentType: 'application/json',
         type: 'POST',
         dataType: 'json',
@@ -144,13 +144,8 @@ function (app, FauxtonAPI, Databases, Documents) {
     },
 
     testReplicate: function () {
-      var deferred = FauxtonAPI.Deferred();
-      /*var dbReplicate = new Databases.Model({
-          id: 'verifytestdb_replicate',
-          name: 'verifytestdb_replicate'
-        });*/
-
-      var promise = dbReplicate.fetch();
+      var deferred = FauxtonAPI.Deferred(),
+          promise = dbReplicate.fetch();
 
       promise.then(function () {
         var docCount = dbReplicate.get('doc_count');

http://git-wip-us.apache.org/repos/asf/couchdb/blob/376bde8e/src/fauxton/app/api.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js
index 9d6ba08..de612b6 100644
--- a/src/fauxton/app/api.js
+++ b/src/fauxton/app/api.js
@@ -55,6 +55,24 @@ function(app, Fauxton) {
       this.hasRendered = false;
     }
   });
+  
+  /*Backbone.ajax = function() {
+    console.log('ajax', arguments);
+    var url = arguments[0].url;
+
+    var old = arguments[0].url,
+        newurl = app.urlPrefix + arguments[0].url;
+
+    if (!url.match(/http/) || !url.match('../..')) {
+      arguments[0].url = app.urlPrefix + arguments[0].url;
+      console.log('url', old, newurl);
+    } else {
+      console.log("didn't change", old);
+    }
+
+    return Backbone.$.ajax.apply(Backbone.$, arguments);
+  };*/
+
 
   FauxtonAPI.navigate = function(url, _opts) {
     var options = _.extend({trigger: true}, _opts );
@@ -124,7 +142,7 @@ function(app, Fauxton) {
   });
 
   FauxtonAPI.Session = Backbone.Model.extend({
-    url: '/_session',
+    url: app.host + '/_session',
 
     user: function () {
       var userCtx = this.get('userCtx');

http://git-wip-us.apache.org/repos/asf/couchdb/blob/376bde8e/src/fauxton/app/app.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/app.js b/src/fauxton/app/app.js
index ac3c0c4..d5c9d1e 100644
--- a/src/fauxton/app/app.js
+++ b/src/fauxton/app/app.js
@@ -43,7 +43,8 @@ function($, _, Backbone, Helpers, Mixins) {
     // move this to here otherwise every once in a while,
     // the footer fails to configure as the url for it is not configured.
     // Having the host declared here fixes it
-    host: window.location.protocol + "//" + window.location.host,
+    host: "../..",//window.location.protocol + "//" + window.location.host,
+    urlPrefix: '../..'
   };
 
   // Localize or create a new JavaScript Template object.

http://git-wip-us.apache.org/repos/asf/couchdb/blob/376bde8e/src/fauxton/app/helpers.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/helpers.js b/src/fauxton/app/helpers.js
index 73a37ca..d4836b9 100644
--- a/src/fauxton/app/helpers.js
+++ b/src/fauxton/app/helpers.js
@@ -48,7 +48,8 @@ function() {
     "_active_tasks": 
"http://docs.couchdb.org/en/latest/api/server/common.html?highlight=stats#active-tasks";,
     "log": 
"http://docs.couchdb.org/en/latest/api/server/common.html?highlight=stats#log";,
     "config": "http://docs.couchdb.org/en/latest/config/index.html";,
-    "views": "http://docs.couchdb.org/en/latest/intro/overview.html#views";
+    "views": "http://docs.couchdb.org/en/latest/intro/overview.html#views";,
+    "changes": 
"http://docs.couchdb.org/en/latest/api/database/changes.html?highlight=changes#post--db-_changes";
   }; 
   
   Helpers.getDocUrl = function(docKey){

http://git-wip-us.apache.org/repos/asf/couchdb/blob/376bde8e/src/fauxton/app/modules/databases/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/resources.js 
b/src/fauxton/app/modules/databases/resources.js
index 237c4ce..8b69cb6 100644
--- a/src/fauxton/app/modules/databases/resources.js
+++ b/src/fauxton/app/modules/databases/resources.js
@@ -78,6 +78,10 @@ function(app, FauxtonAPI, Documents) {
       this.params = options.params;
     },
 
+    documentation: function(){
+      return "changes";
+    },
+
     url: function () {
       var query = "";
       if (this.params) {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/376bde8e/src/fauxton/app/modules/documents/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/resources.js 
b/src/fauxton/app/modules/documents/resources.js
index 75df7d1..eb0ce80 100644
--- a/src/fauxton/app/modules/documents/resources.js
+++ b/src/fauxton/app/modules/documents/resources.js
@@ -179,7 +179,7 @@ function(app, FauxtonAPI) {
     copy: function (copyId) {
       return $.ajax({
         type: 'COPY',
-        url: '/' + this.database.id + '/' + this.id,
+        url: app.host + '/' + this.database.id + '/' + this.id,
         headers: {Destination: copyId}
       });
     },

Reply via email to