Skip to content

Instantly share code, notes, and snippets.

@bricker
Created August 16, 2013 01:18
Show Gist options
  • Save bricker/6246431 to your computer and use it in GitHub Desktop.
Save bricker/6246431 to your computer and use it in GitHub Desktop.
<script type="text/x-handlebars" id="articles">
{{#each controller}}
<figure class="img-wrapper" {{bindAttr style="view.imgWrapperStyle"}}>
</figure>
{{/each}}
</script>
Kpcc.ArticlesView = Ember.View.extend({
imgWrapperStyle: function() {
if(!this.content.get('assets.length')) return "";
var url;
url = this.content.get('assets.firstObject.small.url');
return "background:url("+url+") no-repeat;background-size:cover;";
}.property('content.assets')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment