mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
edfbfd7336
No Issue - Move the ghostPaths from base model to utils - Add initializer that injects it into every route, model and controller - Add a adminUrl and apiUrl helper method
25 lines
659 B
JavaScript
25 lines
659 B
JavaScript
import ghostPaths from 'ghost/utils/ghost-paths';
|
|
|
|
var BaseModel = Ember.Object.extend({
|
|
|
|
fetch: function () {
|
|
return ic.ajax.request(this.url, {
|
|
type: 'GET'
|
|
});
|
|
},
|
|
|
|
save: function () {
|
|
return ic.ajax.request(this.url, {
|
|
type: 'PUT',
|
|
dataType: 'json',
|
|
// @TODO: This is passing _oldWillDestory and _willDestroy and should not.
|
|
data: JSON.stringify(this.getProperties(Ember.keys(this)))
|
|
});
|
|
}
|
|
});
|
|
|
|
BaseModel.apiRoot = ghostPaths().apiRoot;
|
|
BaseModel.subdir = ghostPaths().subdir;
|
|
BaseModel.adminRoot = ghostPaths().adminRoot;
|
|
|
|
export default BaseModel; |