Merge pull request #6548 from ErisDS/config-api

Restructure Configuration API endpoint
This commit is contained in:
Kevin Ansfield 2016-02-24 09:34:51 +00:00
commit ea3bed5911
2 changed files with 6 additions and 10 deletions

View File

@ -31,13 +31,13 @@
<meta name="msapplication-square150x150logo" content="{{asset "img/medium.png" ghost="true"}}" />
<meta name="msapplication-square310x310logo" content="{{asset "img/large.png" ghost="true"}}" />
{{#each configuration}}
<meta name="env-{{this.key}}" content="{{this.value}}" data-type="{{this.type}}" />
{{#each configuration as |config key|}}
<meta name="env-{{key}}" content="{{config.value}}" data-type="{{config.type}}" />
{{/each}}
{{#unless skip_google_fonts}}
{{#if configuration.useGoogleFonts.value}}
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:400,300,700" />
{{/unless}}
{{/if}}
<link rel="stylesheet" href="{{asset "vendor.css" ghost="true" minifyInProduction="true"}}" />
<link rel="stylesheet" href="{{asset "ghost.css" ghost="true" minifyInProduction="true"}}" />

View File

@ -18,7 +18,7 @@ export default AuthenticatedRoute.extend(styleBody, {
model() {
let cachedConfig = this.get('cachedConfig');
let configUrl = this.get('ghostPaths.url').api('configuration');
let configUrl = this.get('ghostPaths.url').api('configuration', 'about');
if (cachedConfig) {
return cachedConfig;
@ -26,12 +26,8 @@ export default AuthenticatedRoute.extend(styleBody, {
return this.get('ajax').request(configUrl)
.then((configurationResponse) => {
let configKeyValues = configurationResponse.configuration;
let [cachedConfig] = configurationResponse.configuration;
cachedConfig = {};
configKeyValues.forEach((configKeyValue) => {
cachedConfig[configKeyValue.key] = configKeyValue.value;
});
this.set('cachedConfig', cachedConfig);
return cachedConfig;