mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
4066d8c680
- Settings fixture that doesn't seem to work - SettingsGeneralRoute with model function calling api - SettingsGeneralModel with save method stubbed - SettingsGeneralController with actions for save, uploadLogo and uploadCover - Let ApplicationRoute handleValidationErrors - Fix actions hash in controller and use bind-attr - Refactor to use single SettingsModel - Implement description word count - Fix broken ajax reference by actually importing ajax method - Refactor to use count-words helper - Refactor isDatedPermalinks into controller - Refactor the isDatedPermalinks to use a custom setter - Remove isDatedPermalinks code from the model
33 lines
No EOL
777 B
JavaScript
33 lines
No EOL
777 B
JavaScript
|
|
function ghostPaths() {
|
|
var path = window.location.pathname,
|
|
subdir = path.substr(0, path.search('/ghost/'));
|
|
|
|
return {
|
|
subdir: subdir,
|
|
apiRoot: subdir + '/ghost/api/v0.1'
|
|
};
|
|
}
|
|
|
|
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;
|
|
|
|
export default BaseModel; |