Skip to content

Instantly share code, notes, and snippets.

@ColinCampbell
Created March 9, 2011 00:26
Show Gist options
  • Select an option

  • Save ColinCampbell/861440 to your computer and use it in GitHub Desktop.

Select an option

Save ColinCampbell/861440 to your computer and use it in GitHub Desktop.
/apps/test_app/resources/main_page.js
// ==========================================================================
// Project: TestApp - mainPage
// Copyright: ©2011 My Company, Inc.
// ==========================================================================
/*globals TestApp */
sc_require('views/tweet');
TestApp.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
childViews: 'list'.w(),
list: SC.ListView.design({
layout: {top: 0, left: 0, right: 0, bottom: 0},
contentBinding: 'TestApp.tweetsController.arrangedObjects',
exampleView: TestApp.TweetView,
selectionBinding: 'TestApp.tweetsController.selection'
})
})
});
// apps/test_app/views/tweet.js
TestApp.TweetView = SC.View.design({
childViews: 'pictureView titleView contentView'.w(),
pictureView: SC.ImageView.design({
layout: {top: 10, left: 10, width: 80, height: 80},
valueBinding: '.parentView*content.pictureUrl'
}),
titleView: SC.LabelView.design({
layout: {top: 10, left: 100, right: 10, height: 18},
valueBinding: '.parentView*content.title'
}),
contentView: SC.LabelView.design({
layout: {top: 30, left: 100, right: 10, bottom: 10},
valueBinding: '.parentView*content.body'
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment