admin-config
Advanced tools
Comparing version 0.11.0 to 0.11.1
@@ -47,5 +47,5 @@ import Menu from './Menu/Menu'; | ||
if (!url) { | ||
url = baseApiUrl + entity.name(); | ||
url = baseApiUrl + encodeURIComponent(entity.name()); | ||
if (identifierValue != null) { | ||
url += '/' + identifierValue; | ||
url += '/' + encodeURIComponent(identifierValue); | ||
} | ||
@@ -52,0 +52,0 @@ } else if (!/^(?:[a-z]+:)?\/\//.test(url)) { |
@@ -17,2 +17,3 @@ import stringUtils from "../Utils/stringUtils"; | ||
this._editable = true; | ||
this._sortable = true; | ||
this._detailLinkRoute = 'edit'; | ||
@@ -197,2 +198,8 @@ this._pinned = false; | ||
sortable(sortable) { | ||
if (!arguments.length) return this._sortable; | ||
this._sortable = sortable; | ||
return this; | ||
} | ||
detailLinkRoute(route) { | ||
@@ -199,0 +206,0 @@ if (!arguments.length) return this._detailLinkRoute; |
{ | ||
"name": "admin-config", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -91,3 +91,3 @@ var assert = require('chai').assert; | ||
entity.url(function(entityName, viewType, identifierValue) { | ||
return '/bar/baz' + (identifierValue ? ('/' + identifierValue * 2) : ''); | ||
return '/bar/baz' + (identifierValue ? ('/' + encodeURIComponent(identifierValue * 2)) : ''); | ||
}); | ||
@@ -105,3 +105,3 @@ application.addEntity(entity); | ||
entity.url(function(entityName, viewType, identifierValue) { | ||
return 'bar/baz' + (identifierValue ? ('/' + identifierValue) : ''); | ||
return 'bar/baz' + (identifierValue ? ('/' + encodeURIComponent(identifierValue)) : ''); | ||
}); | ||
@@ -119,3 +119,3 @@ application.addEntity(entity); | ||
entity.url(function(entityName, viewType, identifierValue) { | ||
return 'http://bar/baz' + (identifierValue ? ('/' + identifierValue) : ''); | ||
return 'http://bar/baz' + (identifierValue ? ('/' + encodeURIComponent(identifierValue)) : ''); | ||
}); | ||
@@ -192,3 +192,3 @@ application.addEntity(entity); | ||
view.url(function (entityId) { | ||
return '/post/:' + entityId; | ||
return '/post/:' + encodeURIComponent(entityId); | ||
}); | ||
@@ -207,3 +207,4 @@ | ||
entity1.url(function (entityName, viewType, identifierValue) { | ||
return '/' + entityName + '_' + viewType + '/:' + identifierValue; | ||
var e = encodeURIComponent; | ||
return '/' + e(entityName) + '_' + e(viewType) + '/:' + e(identifierValue); | ||
}); | ||
@@ -225,2 +226,12 @@ | ||
}); | ||
it('should escape the entity id or name if necessary', function() { | ||
var application = new Application(); | ||
var entity = new Entity('my things'); | ||
application.addEntity(entity); | ||
var view = entity.listView(); | ||
assert.equal('my%20things', application.getRouteFor(entity, view.getUrl(), view.type)); | ||
var id = "thing/12"; | ||
assert.equal('my%20things/thing%2F12', application.getRouteFor(entity, view.getUrl(id), view.type, id, view.identifier())); | ||
}); | ||
}); | ||
@@ -227,0 +238,0 @@ |
@@ -27,5 +27,5 @@ let assert = require('chai').assert, | ||
getRouteFor: (entity, generatedUrl, viewType, id) => { | ||
let url = 'http://localhost/' + entity.name(); | ||
let url = 'http://localhost/' + encodeURIComponent(entity.name()); | ||
if (id) { | ||
url += '/' + id; | ||
url += '/' + encodeURIComponent(id); | ||
} | ||
@@ -32,0 +32,0 @@ |
@@ -21,5 +21,5 @@ let assert = require('chai').assert, | ||
getRouteFor: (entity, generatedUrl, viewType, id) => { | ||
let url = 'http://localhost/' + entity.name(); | ||
let url = 'http://localhost/' + encodeURIComponent(entity.name()); | ||
if (id) { | ||
url += '/' + id; | ||
url += '/' + encodeURIComponent(id); | ||
} | ||
@@ -26,0 +26,0 @@ |
262406
4963