Skip to content

Instantly share code, notes, and snippets.

@adjohu
Created January 26, 2012 12:50
Show Gist options
  • Save adjohu/1682629 to your computer and use it in GitHub Desktop.
Save adjohu/1682629 to your computer and use it in GitHub Desktop.
/*
*
* Models
*
*/
Editor.Element = Em.Object.extend({
type: 'element',
name: 'something',
position: {x:0, y:0},
size: {width:0, height:0},
content: 'abcdefg',
positionChanged: function(){
newPosition = this.get('position');
$(this);
}.observes('position')
});
Editor.TextElement = Editor.Element.extend({
type: 'text'
});
/*
*
* Collections
*
*/
Editor.elements = Em.ArrayController.create({
// Init with empty array
content: [],
current: null,
addElement: function(element){
this.pushObject( element );
this.current = element;
},
load: function(){
this.addElement( Editor.Element.create({name:'lol'}) );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment