diff --git a/ghost/admin/app/components/gh-post-settings-menu.js b/ghost/admin/app/components/gh-post-settings-menu.js index dcab1e268d..6b882880b3 100644 --- a/ghost/admin/app/components/gh-post-settings-menu.js +++ b/ghost/admin/app/components/gh-post-settings-menu.js @@ -5,7 +5,6 @@ import formatMarkdown from 'ghost-admin/utils/format-markdown'; import moment from 'moment'; import {alias, or} from '@ember/object/computed'; import {computed} from '@ember/object'; -import {htmlSafe} from '@ember/string'; import {run} from '@ember/runloop'; import {inject as service} from '@ember/service'; import {task, timeout} from 'ember-concurrency'; @@ -46,16 +45,6 @@ export default Component.extend(SettingsMenuMixin, { twitterImage: or('post.twitterImage', 'post.featureImage'), twitterTitle: or('twitterTitleScratch', 'seoTitle'), - twitterImageStyle: computed('twitterImage', function () { - let image = this.get('twitterImage'); - return htmlSafe(`background-image: url(${image})`); - }), - - facebookImageStyle: computed('facebookImage', function () { - let image = this.get('facebookImage'); - return htmlSafe(`background-image: url(${image})`); - }), - seoDescription: computed('post.scratch', 'metaDescriptionScratch', function () { let metaDescription = this.get('metaDescriptionScratch') || ''; let mobiledoc = this.get('post.scratch'); diff --git a/ghost/admin/app/components/gh-user-active.js b/ghost/admin/app/components/gh-user-active.js index d73cc33b9f..e85ecd5b7c 100644 --- a/ghost/admin/app/components/gh-user-active.js +++ b/ghost/admin/app/components/gh-user-active.js @@ -1,18 +1,12 @@ import Component from '@ember/component'; import moment from 'moment'; import {computed} from '@ember/object'; -import {htmlSafe} from '@ember/string'; export default Component.extend({ tagName: '', user: null, - userImageBackground: computed('user.profileImageUrl', function () { - let url = encodeURI(decodeURI(this.user.get('profileImageUrl'))); - return htmlSafe(`background-image: url(${url})`); - }), - lastLoginUTC: computed('user.lastLoginUTC', function () { let lastLoginUTC = this.get('user.lastLoginUTC'); diff --git a/ghost/admin/app/controllers/team/user.js b/ghost/admin/app/controllers/team/user.js index 3ec1ea6275..e683e70acb 100644 --- a/ghost/admin/app/controllers/team/user.js +++ b/ghost/admin/app/controllers/team/user.js @@ -1,12 +1,10 @@ import Controller from '@ember/controller'; -import Ember from 'ember'; import boundOneWay from 'ghost-admin/utils/bound-one-way'; import isNumber from 'ghost-admin/utils/isNumber'; import validator from 'npm:validator'; import windowProxy from 'ghost-admin/utils/window-proxy'; import {alias, and, not, or, readOnly} from '@ember/object/computed'; import {computed} from '@ember/object'; -import {htmlSafe} from '@ember/string'; import {isArray as isEmberArray} from '@ember/array'; import {run} from '@ember/runloop'; import {inject as service} from '@ember/service'; @@ -61,18 +59,6 @@ export default Controller.extend({ } }), - // duplicated in gh-user-active -- find a better home and consolidate? - userImageBackground: computed('user.profileImageUrl', function () { - let url = encodeURI(decodeURI(this.user.get('profileImageUrl'))); - return htmlSafe(`background-image: url(${url})`); - }), - // end duplicated - - coverImageBackground: computed('user.coverImage', function () { - let url = encodeURI(decodeURI(this.user.get('coverImageUrl'))); - return htmlSafe(`background-image: url(${url})`); - }), - coverTitle: computed('user.name', function () { return `${this.get('user.name')}'s Cover Image`; }), diff --git a/ghost/admin/app/helpers/background-image-style.js b/ghost/admin/app/helpers/background-image-style.js new file mode 100644 index 0000000000..17e4cb466b --- /dev/null +++ b/ghost/admin/app/helpers/background-image-style.js @@ -0,0 +1,13 @@ +import {helper} from '@ember/component/helper'; +import {htmlSafe} from '@ember/string'; + +export function backgroundImageStyle([url]/*, hash*/) { + if (url) { + let safeUrl = encodeURI(decodeURI(url)); + return htmlSafe(`background-image: url(${safeUrl});`); + } + + return ''; +} + +export default helper(backgroundImageStyle); diff --git a/ghost/admin/app/templates/components/gh-post-settings-menu.hbs b/ghost/admin/app/templates/components/gh-post-settings-menu.hbs index 70696eccae..1d8d6e2a05 100644 --- a/ghost/admin/app/templates/components/gh-post-settings-menu.hbs +++ b/ghost/admin/app/templates/components/gh-post-settings-menu.hbs @@ -271,7 +271,7 @@
{{#if twitterImage}} -
+
{{/if}}
{{twitterTitle}}
@@ -341,7 +341,7 @@
{{#if facebookImage}} -
+
{{/if}}
{{truncate facebookTitle 88}}
diff --git a/ghost/admin/app/templates/components/gh-user-list-item.hbs b/ghost/admin/app/templates/components/gh-user-list-item.hbs index dc538f7367..d37be3b9bb 100644 --- a/ghost/admin/app/templates/components/gh-user-list-item.hbs +++ b/ghost/admin/app/templates/components/gh-user-list-item.hbs @@ -2,7 +2,7 @@ {{#link-to 'team.user' user.slug data-test-user-id=user.id}}
- +
diff --git a/ghost/admin/app/templates/team/user.hbs b/ghost/admin/app/templates/team/user.hbs index 3bce9e1d12..59a5641640 100644 --- a/ghost/admin/app/templates/team/user.hbs +++ b/ghost/admin/app/templates/team/user.hbs @@ -96,7 +96,7 @@