From dcdf76a66248a5e05980213e98e3ce69a86828a1 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 23 Sep 2015 11:34:23 -0400 Subject: [PATCH] FIX: Category Logo preview should not repeat --- .../discourse/components/image-uploader.js.es6 | 9 +++++---- .../templates/components/edit-category-images.hbs | 2 +- app/assets/stylesheets/common/base/upload.scss | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/components/image-uploader.js.es6 b/app/assets/javascripts/discourse/components/image-uploader.js.es6 index 4ca6bfdab22..3fc6650a47e 100644 --- a/app/assets/javascripts/discourse/components/image-uploader.js.es6 +++ b/app/assets/javascripts/discourse/components/image-uploader.js.es6 @@ -1,13 +1,14 @@ +import property from 'ember-addons/ember-computed-decorators'; import UploadMixin from "discourse/mixins/upload"; export default Em.Component.extend(UploadMixin, { classNames: ["image-uploader"], - backgroundStyle: function() { - const imageUrl = this.get("imageUrl"); + @property('imageUrl') + backgroundStyle(imageUrl) { if (Em.isNone(imageUrl)) { return; } - return ("background-image: url(" + imageUrl + ")").htmlSafe(); - }.property("imageUrl"), + return `background-image: url(${imageUrl})`.htmlSafe(); + }, uploadDone(upload) { this.set("imageUrl", upload.url); diff --git a/app/assets/javascripts/discourse/templates/components/edit-category-images.hbs b/app/assets/javascripts/discourse/templates/components/edit-category-images.hbs index f4d7995dfdc..84139b501d4 100644 --- a/app/assets/javascripts/discourse/templates/components/edit-category-images.hbs +++ b/app/assets/javascripts/discourse/templates/components/edit-category-images.hbs @@ -1,6 +1,6 @@
- {{image-uploader imageUrl=category.logo_url type="category_logo"}} + {{image-uploader imageUrl=category.logo_url type="category_logo" class="no-repeat"}}
diff --git a/app/assets/stylesheets/common/base/upload.scss b/app/assets/stylesheets/common/base/upload.scss index 6afba003ef1..9777fd32046 100644 --- a/app/assets/stylesheets/common/base/upload.scss +++ b/app/assets/stylesheets/common/base/upload.scss @@ -2,3 +2,9 @@ background-size: cover; background: $primary center center; } + +.image-uploader.no-repeat { + .uploaded-image-preview { + background-repeat: no-repeat; + } +}