FIX: Category Logo preview should not repeat

This commit is contained in:
Robin Ward 2015-09-23 11:34:23 -04:00
parent ef0804fbb0
commit dcdf76a662
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";
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);

View file

@ -1,6 +1,6 @@
<section class='field'>
<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 class='field'>

View file

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