0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Use new slug endpoint in ember admin

Closes #2831
-use new slug endpoint in fixture
-use new slug endpoint in post model
-do not try to generate slug for zero length titles
This commit is contained in:
Jason Williams 2014-05-29 15:14:36 +00:00
parent d3c1bdb758
commit 86a7e483b5
2 changed files with 8 additions and 2 deletions

View file

@ -41,7 +41,7 @@ var defineFixtures = function (status) {
ic.ajax.defineFixture('/ghost/api/v0.1/posts/2', post(2, status));
ic.ajax.defineFixture('/ghost/api/v0.1/posts/3', post(3, status));
ic.ajax.defineFixture('/ghost/api/v0.1/posts/4', post(4, status));
ic.ajax.defineFixture('/ghost/api/v0.1/posts/slug/test%20title/', response('generated-slug', status));
ic.ajax.defineFixture('/ghost/api/v0.1/slugs/post/test%20title/', response('generated-slug', status));
ic.ajax.defineFixture('/ghost/api/v0.1/users/me/', user(status));
ic.ajax.defineFixture('/ghost/changepw/', response({

View file

@ -22,7 +22,13 @@ var Post = DS.Model.extend({
generateSlug: function () {
var title = this.get('title'),
url = this.get('ghostPaths').apiUrl('posts', 'slug', encodeURIComponent(title));
url;
if (!title) {
return;
}
url = this.get('ghostPaths').apiUrl('slugs', 'post', encodeURIComponent(title));
return ic.ajax.request(url, {
type: 'GET'