FIX: Category Logo preview should not repeat

This commit is contained in:
Robin Ward 2015-09-23 11:34:23 -04:00
parent 931812ce69
commit 7a155710dd
3 changed files with 12 additions and 5 deletions

View File

@ -1,13 +1,14 @@
import property from 'ember-addons/ember-computed-decorators';
import UploadMixin from "discourse/mixins/upload"; import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, { export default Em.Component.extend(UploadMixin, {
classNames: ["image-uploader"], classNames: ["image-uploader"],
backgroundStyle: function() { @property('imageUrl')
const imageUrl = this.get("imageUrl"); backgroundStyle(imageUrl) {
if (Em.isNone(imageUrl)) { return; } if (Em.isNone(imageUrl)) { return; }
return ("background-image: url(" + imageUrl + ")").htmlSafe(); return `background-image: url(${imageUrl})`.htmlSafe();
}.property("imageUrl"), },
uploadDone(upload) { uploadDone(upload) {
this.set("imageUrl", upload.url); this.set("imageUrl", upload.url);

View File

@ -1,6 +1,6 @@
<section class='field'> <section class='field'>
<label>{{i18n 'category.logo'}}</label> <label>{{i18n 'category.logo'}}</label>
{{image-uploader imageUrl=category.logo_url type="category_logo"}} {{image-uploader imageUrl=category.logo_url type="category_logo" class="no-repeat"}}
</section> </section>
<section class='field'> <section class='field'>

View File

@ -2,3 +2,9 @@
background-size: cover; background-size: cover;
background: $primary center center; background: $primary center center;
} }
.image-uploader.no-repeat {
.uploaded-image-preview {
background-repeat: no-repeat;
}
}