Skip to content

Commit

Permalink
return backgrounImage as html safe
Browse files Browse the repository at this point in the history
so it can be used as-is in the template on other elements
  • Loading branch information
Brian Whitton committed Apr 10, 2017
1 parent 34b2dc2 commit 26672a4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions addon/components/nypr-brick-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ export default Component.extend({
classNameBindings: ['item.attributes.template'],
attributeBindings: ['style'],

style: computed('backgroundImage', function() {
return htmlSafe(`background-image: ${get(this, 'backgroundImage')}`);
}),
style: computed.reads('backgroundImage'),
pk: reads('item.id'),
vertical: equal('template', 'vertical'),
backgroundImage: computed.reads('item.attributes.imageMain.url')
backgroundImage: computed('item.attributes.imageMain.url', function() {
let backgroundImage = get(this, 'item.attributes.imageMain.url');
if (backgroundImage) {
return htmlSafe(`background-image: url(${backgroundImage});`);
}
})
});

0 comments on commit 26672a4

Please sign in to comment.