1
0
Fork 0
This commit is contained in:
hkernbach 2016-04-07 12:54:16 +02:00
parent 00fb467592
commit f2691ba818
4 changed files with 50 additions and 10 deletions

View File

@ -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,

View File

@ -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) {

View File

@ -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() {