Skip to content

Instantly share code, notes, and snippets.

@shawndeprey
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawndeprey/884365b4ef8cec8a3b95 to your computer and use it in GitHub Desktop.
Save shawndeprey/884365b4ef8cec8a3b95 to your computer and use it in GitHub Desktop.
App.ImgView = Ember.View.extend({
tagName: 'img',
attributeBindings: ['src', 'alt', 'onerror'],
defaultPlaceholderImgUrl: "<%= asset_path('kite-client/defaults/default.png') %>",
companyPlaceholderImgUrl: "<%= asset_path('kite-client/defaults/company.png') %>",
onerror: function(){
return "this.onerror=null;this.src='" + this.get('placeholder') + "';"
}.property('src'),
placeholder: function(){
return this.get(this.get('placeholderName') + 'PlaceholderImgUrl') || this.get('defaultPlaceholderImgUrl');
}.property('placeholderName')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment