mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 19:37:55 +08:00
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({
|
||||
tagName: 'img',
|
||||
attributeBindings: ['cdnSrc:src'],
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
cdnSrc: function() {
|
||||
return Discourse.getURLWithCDN(this.get('src'));
|
||||
}.property('src')
|
||||
export default Ember.Component.extend({
|
||||
tagName: '',
|
||||
|
||||
@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
Block a user