Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Moved post route under posts resource - Changed ajax to use ic.ajax.request instead of ic.ajax.raw
- Loading branch information
Showing
12 changed files
with
70 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/*global ic */ | ||
import postFixtures from 'ghost/fixtures/posts'; | ||
|
||
var post = function (id) { | ||
return { | ||
response: postFixtures.findBy('id', id), | ||
jqXHR: {}, | ||
textStatus: 'success' | ||
}; | ||
}; | ||
|
||
var posts = function () { | ||
return { | ||
response: postFixtures, | ||
jqXHR: {}, | ||
textStatus: 'success' | ||
}; | ||
}; | ||
|
||
export default function () { | ||
ic.ajax.defineFixture('/ghost/api/v0.1/posts', posts()); | ||
ic.ajax.defineFixture('/ghost/api/v0.1/posts/1', post(1)); | ||
ic.ajax.defineFixture('/ghost/api/v0.1/posts/2', post(2)); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var PostModel = Ember.Object.extend({ | ||
|
||
}); | ||
|
||
export default PostModel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export default Ember.Route.extend({ | ||
// redirect to first post subroute | ||
redirect: function () { | ||
var firstPost = this.modelFor('posts').posts[0]; | ||
var firstPost = (this.modelFor('posts') || []).get('firstObject'); | ||
|
||
if (firstPost) { | ||
this.transitionTo('post', firstPost); | ||
this.transitionTo('posts.post', firstPost); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/*global ajax */ | ||
|
||
export default Ember.Route.extend({ | ||
model: function (params) { | ||
return ajax("/ghost/api/v0.1/posts/" + params.post_id); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* global ic */ | ||
export default function ajax() { | ||
return ic.ajax.raw.apply(null, arguments); | ||
} | ||
export default window.ajax = function () { | ||
return ic.ajax.request.apply(null, arguments); | ||
}; |