Skip to content

Instantly share code, notes, and snippets.

@caligo-mentis
Created May 24, 2012 07:11
Show Gist options
  • Select an option

  • Save caligo-mentis/2779986 to your computer and use it in GitHub Desktop.

Select an option

Save caligo-mentis/2779986 to your computer and use it in GitHub Desktop.
App.SelectableCollectionView = Ember.CollectionView.extend({
selected: null,
itemViewClass: Ember.View.extend({
attributeBindings: ['isSelected'],
isSelected: Ember.computed(function() {
return this.get('content') === this.getPath('parentView.selected');
}).property('parentView.selected').cacheable(),
click: function(event) {
var selected = this.get('content');
this.setPath('parentView.selected', selected);
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment