Skip to content

Instantly share code, notes, and snippets.

@ppcano
Created January 26, 2012 12:59
Show Gist options
  • Select an option

  • Save ppcano/1682657 to your computer and use it in GitHub Desktop.

Select an option

Save ppcano/1682657 to your computer and use it in GitHub Desktop.
Editor.Element = Em.Object.extend({
x: 0,
y:0,
witdth: 0,
height: 0
});
// don't forget to use set / get for access the properties of the model
Editor.elements = Em.ArrayController.create({
// use pushObject or popOBject, remove Object and set the content on the property
});
Editor.CollectionView = Em.CollectionView.extend({
contentBinding: Em.Binding.oneWay('Editor.elements.content'),
itemViewClass: Em.View.extend({
// the content of this class will be each Editor.Element
// set observes on either the content or content.x content.y content.width
// and access this.$()
didInsertElement: function() {
// do any setup with this.$()
},
template: Em.Handlebars.compile('my tetxt')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment