Last active
August 29, 2015 14:17
-
-
Save shawndeprey/884365b4ef8cec8a3b95 to your computer and use it in GitHub Desktop.
This file contains 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
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