Skip to content

Instantly share code, notes, and snippets.

@ColinCampbell
Created August 11, 2010 17:41
Show Gist options
  • Select an option

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

Select an option

Save ColinCampbell/519372 to your computer and use it in GitHub Desktop.
// apps/test/controllers/display.js
Test.displayController = SC.ObjectController.extend({
nowShowing: 'Test.mainPage.displayView',
showDisplayView: function() {
this.set('nowShowing', 'Test.mainPage.displayView');
},
showCodeView: function() {
this.set('nowShowing', 'Test.mainPage.codeView');
}
});
// apps/test/resources/main_page.js
Test.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
childViews: 'container buttons'.w(),
containerView: SC.ContainerView.design({
layout: {top:30},
nowShowingBinding: 'Test.displayController.nowShowing'
}),
buttons: SC.View.design({
layout: {centerX:0, width:410},
childViews: 'displayButton codeButton'.w(),
displayButton: SC.ButtonView.design({
layout: {height:24, width:200},
action: 'Test.displayController.showDisplayView',
title: "Display View"
}),
codeButton: SC.ButtonView.design({
layout: {height:24, left: 210, width:200},
action: 'Test.displayController.showCodeView',
title: "Code View"
})
})
}),
displayView: SC.View.design({
childViews: 'label'.w(),
label: SC.LabelView.design({
value: "Display"
})
}),
codeView: SC.View.design({
childViews: 'label'.w(),
label: SC.LabelView.design({
value: "Code"
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment