-
-
Save workmanw/1071927 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ========================================================================== | |
// 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