Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Switched About screen to use config service
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinansfield committed Feb 26, 2019
1 parent e6a6b09 commit 020b3f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
5 changes: 2 additions & 3 deletions app/controllers/about.js
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
25 changes: 1 addition & 24 deletions app/routes/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
});
8 changes: 4 additions & 4 deletions app/templates/about.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 020b3f8

Please sign in to comment.