Skip to content

Instantly share code, notes, and snippets.

@adjohu
Created January 27, 2012 16:01
Show Gist options
  • Save adjohu/1689478 to your computer and use it in GitHub Desktop.
Save adjohu/1689478 to your computer and use it in GitHub Desktop.
Editor.ElementView = Em.View.extend({
classNameBindings: ['isSelected'],
/*
isSelected: false,
selectedElementChanged: Em.observer(function(){
var selectedElement = Editor.selectedElementController.get('content');
var isSelected = selectedElement == this.get('content');
this.set('isSelected', isSelected);
}).observes('Editor.selectedElementController.content'),
*/
isSelected: function(){
var selectedElement = Editor.selectedElementController.get('content'),
content = this.get('content');
return selectedElement == content;
}.property('Editor.selectedElementController', 'content'),
click: function(){
// Select this element on click
Editor.selectedElementController.set('content', this.content);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment