Skip to content

Instantly share code, notes, and snippets.

@mixonic
Forked from bricker/template.html
Last active December 21, 2015 03:59
Show Gist options
  • Save mixonic/6246467 to your computer and use it in GitHub Desktop.
Save mixonic/6246467 to your computer and use it in GitHub Desktop.
<script type="text/x-handlebars" id="articles">
{{#each controller itemController="article"}}
<figure class="img-wrapper" {{bindAttr style="imgWrapperStyle"}}>
</figure>
{{/each}}
</script>
Kpcc.ArticleController = Ember.ObjectController.extend({
imgWrapperStyle: function(){
var assets = this.get('assets');
if (!assets.get('length'))
return '';
var url = assets.get('firstObject.small.url');
return "backgorund: url("+url+") no-repeat; background-size: cover;";
}.property('assets.@each')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment