cdn-img will render nothing if src is null
This commit is contained in:
parent
c423544208
commit
5c4f37a24e
|
@ -1,8 +1,10 @@
|
||||||
export default Ember.Component.extend({
|
import computed from 'ember-addons/ember-computed-decorators';
|
||||||
tagName: 'img',
|
|
||||||
attributeBindings: ['cdnSrc:src'],
|
|
||||||
|
|
||||||
cdnSrc: function() {
|
export default Ember.Component.extend({
|
||||||
return Discourse.getURLWithCDN(this.get('src'));
|
tagName: '',
|
||||||
}.property('src')
|
|
||||||
|
@computed('src')
|
||||||
|
cdnSrc(src) {
|
||||||
|
return Discourse.getURLWithCDN(src);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{{#if src}}
|
||||||
|
<img src={{cdnSrc}} class={{class}}>
|
||||||
|
{{/if}}
|
Loading…
Reference in New Issue