2014-05-14 20:56:43 -05:00
|
|
|
import ghostPaths from 'ghost/utils/ghost-paths';
|
2014-03-22 21:31:45 -05:00
|
|
|
|
|
|
|
var BaseModel = Ember.Object.extend({
|
2014-03-20 21:55:32 -05:00
|
|
|
|
|
|
|
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)))
|
|
|
|
});
|
|
|
|
}
|
2014-03-22 21:31:45 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
BaseModel.apiRoot = ghostPaths().apiRoot;
|
|
|
|
BaseModel.subdir = ghostPaths().subdir;
|
2014-04-07 17:01:46 -05:00
|
|
|
BaseModel.adminRoot = ghostPaths().adminRoot;
|
2014-03-22 21:31:45 -05:00
|
|
|
|
|
|
|
export default BaseModel;
|