Created
August 16, 2013 01:18
-
-
Save bricker/6246431 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/x-handlebars" id="articles"> | |
{{#each controller}} | |
<figure class="img-wrapper" {{bindAttr style="view.imgWrapperStyle"}}> | |
</figure> | |
{{/each}} | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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