diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoDocument.js b/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoDocument.js index dc0770da7e..0a6b05ee82 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoDocument.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoDocument.js @@ -11,7 +11,7 @@ window.arangoDocument = Backbone.Collection.extend({ cache: false, type: 'DELETE', contentType: "application/json", - url: "/_api/edge/" + colid + "/" + docid, + url: "/_api/edge/" + encodeURIComponent(colid) + "/" + encodeURIComponent(docid), success: function () { callback(false); }, @@ -25,7 +25,7 @@ window.arangoDocument = Backbone.Collection.extend({ cache: false, type: 'DELETE', contentType: "application/json", - url: "/_api/document/" + colid + "/" + docid, + url: "/_api/document/" + encodeURIComponent(colid) + "/" + encodeURIComponent(docid), success: function () { callback(false); }, @@ -116,7 +116,7 @@ window.arangoDocument = Backbone.Collection.extend({ $.ajax({ cache: false, type: "GET", - url: "/_api/edge/" + colid +"/"+ docid, + url: "/_api/edge/" + encodeURIComponent(colid) +"/"+ encodeURIComponent(docid), contentType: "application/json", processData: false, success: function(data) { @@ -134,7 +134,7 @@ window.arangoDocument = Backbone.Collection.extend({ $.ajax({ cache: false, type: "GET", - url: "/_api/document/" + colid +"/"+ docid, + url: "/_api/document/" + encodeURIComponent(colid) +"/"+ encodeURIComponent(docid), contentType: "application/json", processData: false, success: function(data) { @@ -150,7 +150,7 @@ window.arangoDocument = Backbone.Collection.extend({ $.ajax({ cache: false, type: "PUT", - url: "/_api/edge/" + colid + "/" + docid, + url: "/_api/edge/" + encodeURIComponent(colid) + "/" + encodeURIComponent(docid), data: model, contentType: "application/json", processData: false, @@ -166,7 +166,7 @@ window.arangoDocument = Backbone.Collection.extend({ $.ajax({ cache: false, type: "PUT", - url: "/_api/document/" + colid + "/" + docid, + url: "/_api/document/" + encodeURIComponent(colid) + "/" + encodeURIComponent(docid), data: model, contentType: "application/json", processData: false, diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/routers/router.js b/js/apps/system/_admin/aardvark/APP/frontend/js/routers/router.js index 2ca42c4019..442b0ffd95 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/routers/router.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/routers/router.js @@ -305,7 +305,17 @@ }); } this.documentView.colid = colid; - this.documentView.docid = docid; + + var doc = window.location.hash.split("/")[2]; + + var test = (doc.split("%").length - 1) % 3; + + if (decodeURI(doc) !== doc && test !== 0) { + doc = decodeURIComponent(doc); + } + this.documentView.docid = doc; + + this.documentView.render(); var callback = function(error, type) { diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/.clusterView.js.swp b/js/apps/system/_admin/aardvark/APP/frontend/js/views/.clusterView.js.swp deleted file mode 100644 index 14523e318d..0000000000 Binary files a/js/apps/system/_admin/aardvark/APP/frontend/js/views/.clusterView.js.swp and /dev/null differ diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/documentsView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/documentsView.js index c44db39b0e..d950f9d5cc 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/documentsView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/documentsView.js @@ -585,6 +585,7 @@ var from = $('.modal-body #new-edge-from-attr').last().val(); var to = $('.modal-body #new-edge-to').last().val(); var key = $('.modal-body #new-edge-key-attr').last().val(); + var url; var callback = function(error, data) { @@ -593,7 +594,15 @@ } else { window.modalView.hide(); - window.location.hash = "collection/" + data; + data = data.split('/'); + + try { + url = "collection/" + data[0] + '/' + data[1]; + decodeURI(url); + } catch (ex) { + url = "collection/" + data[0] + '/' + encodeURIComponent(data[1]); + } + window.location.hash = url; } }.bind(this); @@ -608,6 +617,7 @@ addDocument: function() { var collid = window.location.hash.split("/")[1]; var key = $('.modal-body #new-document-key-attr').last().val(); + var url; var callback = function(error, data) { if (error) { @@ -615,7 +625,16 @@ } else { window.modalView.hide(); - window.location.hash = "collection/" + data; + data = data.split('/'); + + try { + url = "collection/" + data[0] + '/' + data[1]; + decodeURI(url); + } catch (ex) { + url = "collection/" + data[0] + '/' + encodeURIComponent(data[1]); + } + + window.location.hash = url; } }.bind(this); @@ -862,7 +881,18 @@ clicked: function (event) { var self = event.currentTarget; - window.App.navigate("collection/" + this.collection.collectionID + "/" + $(self).attr("id").substr(4), true); + + var url, doc = $(self).attr("id").substr(4); + + try { + url = "collection/" + this.collection.collectionID + '/' + doc; + decodeURI(doc); + } catch (ex) { + url = "collection/" + this.collection.collectionID + '/' + encodeURIComponent(doc); + } + + //window.App.navigate(url, true); + window.location.hash = url; }, drawTable: function() {