2015-05-26 05:10:50 +03:00
|
|
|
import Ember from 'ember';
|
2015-05-27 03:41:12 +03:00
|
|
|
import {request as ajax} from 'ic-ajax';
|
2015-05-25 19:00:42 +03:00
|
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
|
|
import styleBody from 'ghost/mixins/style-body';
|
|
|
|
|
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'],
|
|
|
|
|
2015-05-26 05:10:50 +03:00
|
|
|
ghostPaths: Ember.inject.service('ghost-paths'),
|
|
|
|
|
2015-05-25 19:00:42 +03:00
|
|
|
cachedConfig: false,
|
2015-05-25 21:17:10 +03:00
|
|
|
|
2015-05-25 19:00:42 +03:00
|
|
|
model: function () {
|
|
|
|
var cachedConfig = this.get('cachedConfig'),
|
|
|
|
self = this;
|
2015-05-25 21:17:10 +03:00
|
|
|
|
2015-05-25 19:00:42 +03:00
|
|
|
if (cachedConfig) {
|
|
|
|
return cachedConfig;
|
|
|
|
}
|
|
|
|
|
2015-05-27 03:41:12 +03:00
|
|
|
return ajax(this.get('ghostPaths.url').api('configuration'))
|
2015-05-25 19:00:42 +03:00
|
|
|
.then(function (configurationResponse) {
|
|
|
|
var configKeyValues = configurationResponse.configuration;
|
2015-05-25 21:17:10 +03:00
|
|
|
|
2015-05-25 19:00:42 +03:00
|
|
|
cachedConfig = {};
|
|
|
|
configKeyValues.forEach(function (configKeyValue) {
|
|
|
|
cachedConfig[configKeyValue.key] = configKeyValue.value;
|
|
|
|
});
|
|
|
|
self.set('cachedConfig', cachedConfig);
|
2015-05-25 21:17:10 +03:00
|
|
|
|
2015-05-25 19:00:42 +03:00
|
|
|
return cachedConfig;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|