From 5c4f37a24e0e2fc99b6e1116fc1885b1a898e8d5 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 15 Mar 2017 13:30:29 -0400 Subject: [PATCH] cdn-img will render nothing if src is null --- .../discourse/components/cdn-img.js.es6 | 14 ++++++++------ .../discourse/templates/components/cdn-img.hbs | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 app/assets/javascripts/discourse/templates/components/cdn-img.hbs diff --git a/app/assets/javascripts/discourse/components/cdn-img.js.es6 b/app/assets/javascripts/discourse/components/cdn-img.js.es6 index 007d9cb9039..7be0c0b5615 100644 --- a/app/assets/javascripts/discourse/components/cdn-img.js.es6 +++ b/app/assets/javascripts/discourse/components/cdn-img.js.es6 @@ -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); + } }); diff --git a/app/assets/javascripts/discourse/templates/components/cdn-img.hbs b/app/assets/javascripts/discourse/templates/components/cdn-img.hbs new file mode 100644 index 00000000000..e4e4459ddbc --- /dev/null +++ b/app/assets/javascripts/discourse/templates/components/cdn-img.hbs @@ -0,0 +1,3 @@ +{{#if src}} + +{{/if}} \ No newline at end of file