Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created March 29, 2011 00:57
Show Gist options
  • Save joegaudet/891644 to your computer and use it in GitHub Desktop.
Save joegaudet/891644 to your computer and use it in GitHub Desktop.
// Collection Template
DarkHorse.UserSummaryItemsTemplate = SC.TemplateCollectionView.extend( {
contentBinding: 'DarkHorse.profileController.summaryItemsController',
templateName: 'summary_items'
});
// View
contentView: SC.TemplateView.design( {
templateName: 'summary_items'
})
// handlebars
{{#collection "DarkHorse.UserSummaryItemsTemplate"}}
<label>{{content.fieldName}}</label>
<div>
{{content.fieldValue}}
</div>
{{/collection}}
// controller (the relevant part)
DarkHorse.profileController = SC.ObjectController.create( {
content: null,
contentBinding: "DarkHorse.currentUserController",
summaryItemsController: SC.ArrayController.create( {
content: [],
contentBinding: "DarkHorse.profileController.summaryItems"
}),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment