Skip to content

Instantly share code, notes, and snippets.

@publickeating
publickeating / CustomItemView.js
Last active August 29, 2015 14:01
This is an example of a custom item view that contains childViews.
// Note: by mixing in SC.ContentDisplay, we get `content` added as a displayProperty
MyApp.CustomItemView = SC.View.extend(SC.ContentDisplay, {
// ---------------------------------------------------------------------------
// Properties
//
classNames: ['custom-item-view'],
content: null,
@publickeating
publickeating / basic_form.js
Created November 18, 2014 15:05
Basic SproutCore Form
myForm: SC.View.extend({
childViews: ['nameLabel', 'givenNameField', 'familyNameField', 'imageField', 'phoneLabel', 'phoneField', // ... etc. ],
// To save us the trouble of offsetting each view independently, we use a child layout plugin that stacks them vertically.
childViewLayout: SC.View.VERTICAL_STACK,
childViewLayoutOptions: { paddingBefore: 35, paddingAfter: 35, spacing: 14 },
nameLabel: SC.LabelView.extend({
classNames: ['form-label'],
layout: { left: 20, height: 20 },