Skip to content

Instantly share code, notes, and snippets.

@workmanw
Forked from henrygarner/sample.js
Created July 8, 2011 14:13
Embed
What would you like to do?
// ==========================================================================
// Project: Sample
// Copyright: @2011 My Company, Inc.
// ==========================================================================
/*globals Sample */
Sample = SC.Application.create({
store: SC.Store.create().from(SC.Record.fixtures)
});
/* == MODELS == */
Sample.Child = SC.Record.extend({
name: SC.Record.attr(String)
});
Sample.Child.FIXTURES = [
{ "guid" : 1, "name" : "Child 1" },
{ "guid" : 2, "name" : "Child 2" },
{ "guid" : 3, "name" : "Child 3" },
{ "guid" : 4, "name" : "Child 4" }
];
/* == Controllers == */
Sample.childrenController = SC.ArrayController.create({
allowsEmptySelection: NO
});
Sample.childController = SC.ObjectController.create({
contentBinding: 'Sample.childrenController.selection',
contentBindingDefault: SC.Binding.single()
});
SC.ready(function() {
Sample.childrenController.set('content', Sample.store.find(Sample.Child));
Sample.mainPane = SC.TemplatePane.append({
childBinding: 'Sample.childController',
template: SC.Handlebars.compile('Hello, {{child.name}}')
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment