Created
July 12, 2014 23:46
-
-
Save jakecraige/d368f9164f32a6bb58fe 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
import DS from 'ember-data'; | |
import Ember from 'ember'; | |
var attr = DS.attr; | |
var belongsTo = DS.belongsTo; | |
export default DS.Model.extend({ | |
url: attr(), | |
image: attr(), | |
caption: attr(), | |
sortKey: attr('number', { defaultValue: 99 }), | |
event: belongsTo('event'), | |
backgroundImageStyle: Ember.computed('url', 'image', function() { | |
var image = this.get('url'); | |
if(!image) { | |
image = this.get('image'); | |
} | |
return 'background-image:url(' + image + ');'; | |
}) | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment