From 020b3f86e1265958ea800a97d3688b971d811e58 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Tue, 26 Feb 2019 16:12:34 +0700 Subject: [PATCH] Switched About screen to use `config` service --- app/controllers/about.js | 5 ++--- app/routes/about.js | 25 +------------------------ app/templates/about.hbs | 8 ++++---- 3 files changed, 7 insertions(+), 31 deletions(-) diff --git a/app/controllers/about.js b/app/controllers/about.js index ca292b8ef7..adb9d7dff0 100644 --- a/app/controllers/about.js +++ b/app/controllers/about.js @@ -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(); diff --git a/app/routes/about.js b/app/routes/about.js index 0fdfce85b0..ad9f5fbbcf 100644 --- a/app/routes/about.js +++ b/app/routes/about.js @@ -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'] }); diff --git a/app/templates/about.hbs b/app/templates/about.hbs index bf9da0901c..079637474b 100644 --- a/app/templates/about.hbs +++ b/app/templates/about.hbs @@ -5,10 +5,10 @@
    -
  • Version {{about.version}}
  • -
  • Environment {{about.environment}}
  • -
  • Database {{about.database}}
  • -
  • Mail {{#if about.mail}}{{about.mail}}{{else}}Native{{/if}}
  • +
  • Version {{config.version}}
  • +
  • Environment {{config.environment}}
  • +
  • Database {{config.database}}
  • +
  • Mail {{#if config.mail}}{{config.mail}}{{else}}Native{{/if}}