2016-06-30 13:21:47 +03:00
|
|
|
import injectService from 'ember-service/inject';
|
2016-05-24 15:06:59 +03:00
|
|
|
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
|
|
import styleBody from 'ghost-admin/mixins/style-body';
|
2015-05-25 19:00:42 +03:00
|
|
|
|
2015-05-25 21:17:10 +03:00
|
|
|
export default AuthenticatedRoute.extend(styleBody, {
|
2015-05-25 19:00:42 +03:00
|
|
|
titleToken: 'About',
|
|
|
|
|
|
|
|
classNames: ['view-about'],
|
|
|
|
|
2016-06-30 13:21:47 +03:00
|
|
|
ghostPaths: injectService(),
|
|
|
|
ajax: injectService(),
|
2015-05-26 05:10:50 +03:00
|
|
|
|
2015-05-25 19:00:42 +03:00
|
|
|
cachedConfig: false,
|
2015-05-25 21:17:10 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
model() {
|
|
|
|
let cachedConfig = this.get('cachedConfig');
|
2016-02-19 21:18:14 +03:00
|
|
|
let configUrl = this.get('ghostPaths.url').api('configuration', 'about');
|
2015-05-25 21:17:10 +03:00
|
|
|
|
2015-05-25 19:00:42 +03:00
|
|
|
if (cachedConfig) {
|
|
|
|
return cachedConfig;
|
|
|
|
}
|
|
|
|
|
2016-01-18 18:37:14 +03:00
|
|
|
return this.get('ajax').request(configUrl)
|
2015-10-28 14:36:45 +03:00
|
|
|
.then((configurationResponse) => {
|
2016-02-19 21:18:14 +03:00
|
|
|
let [cachedConfig] = configurationResponse.configuration;
|
2015-05-25 21:17:10 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
this.set('cachedConfig', cachedConfig);
|
2015-05-25 21:17:10 +03:00
|
|
|
|
2015-05-25 19:00:42 +03:00
|
|
|
return cachedConfig;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|