Switched About screen to use config service

This commit is contained in:
Kevin Ansfield 2019-02-26 16:12:34 +07:00
parent 57f9663b6e
commit e6df64ed52
3 changed files with 7 additions and 31 deletions

View File

@ -1,13 +1,12 @@
import Controller from '@ember/controller';
import {computed} from '@ember/object';
import {readOnly} from '@ember/object/computed';
import {inject as service} from '@ember/service';
/* eslint-disable ghost/ember/alias-model-in-controller */
export default Controller.extend({
config: service(),
upgradeStatus: service(),
about: readOnly('model'),
copyrightYear: computed(function () {
let date = new Date();
return date.getFullYear();

View File

@ -3,30 +3,7 @@ import styleBody from 'ghost-admin/mixins/style-body';
import {inject as service} from '@ember/service';
export default AuthenticatedRoute.extend(styleBody, {
ghostPaths: service(),
ajax: service(),
titleToken: 'About',
classNames: ['view-about'],
cachedConfig: false,
model() {
let cachedConfig = this.get('cachedConfig');
let configUrl = this.get('ghostPaths.url').api('configuration', 'about');
if (cachedConfig) {
return cachedConfig;
}
return this.get('ajax').request(configUrl)
.then((configurationResponse) => {
let [cachedConfig] = configurationResponse.configuration;
this.set('cachedConfig', cachedConfig);
return cachedConfig;
});
}
classNames: ['view-about']
});

View File

@ -5,10 +5,10 @@
<section class="view-container">
<section class="gh-env-details">
<ul class="gh-env-list">
<li class="gh-env-list-version"><strong>Version</strong> {{about.version}}</li>
<li><strong>Environment</strong> {{about.environment}}</li>
<li class="gh-env-list-database-type"><strong>Database</strong> {{about.database}}</li>
<li><strong>Mail</strong> {{#if about.mail}}{{about.mail}}{{else}}Native{{/if}}</li>
<li class="gh-env-list-version"><strong>Version</strong> {{config.version}}</li>
<li><strong>Environment</strong> {{config.environment}}</li>
<li class="gh-env-list-database-type"><strong>Database</strong> {{config.database}}</li>
<li><strong>Mail</strong> {{#if config.mail}}{{config.mail}}{{else}}Native{{/if}}</li>
</ul>
<div class="gh-env-help">
<a class="gh-btn" href="https://docs.ghost.org" target="_blank"><span>User Documentation</span></a>