Skip to content

Instantly share code, notes, and snippets.

@frekw
Created May 18, 2009 11:44
Show Gist options
  • Save frekw/113428 to your computer and use it in GitHub Desktop.
Save frekw/113428 to your computer and use it in GitHub Desktop.
Controller:
Todos.popupController = SC.Object.create(
popupShowing: false,
showPopup: function(){ this.set('popupShowing', true) },
hidePopup: function(){ this.set('popupShowing', false) }
// ... //
}) ;
View:
popup: SC.PanelPane.create({
layout: { width: 400, height: 200, centerX: 0, centerY: 0 },
visibileBinding: 'Todos.popupController.popupShowing', // doesn't work.
contentView: SC.View.extend({
layout: { top: 0, left: 0, bottom: 0, right: 0 },
childViews: 'labelView inputView cancelButton addButton'.w(),
labelView: SC.LabelView.extend({
layout: { centerY: -30, height: 24, left: 0, right: 0 },
textAlign: SC.ALIGN_CENTER,
controlSize: SC.LARGE_CONTROL_SIZE,
value: "Please enter a description"
}),
inputView: SC.TextFieldView.extend({
layout: { centerY: 0, height: 24, left: 20, right: 20 },
valueBinding: 'Todos.popupController.description'
}),
cancelButton: SC.ButtonView.extend({
layout: { width: 80, bottom: 20, height: 21, right: 110 },
title: "Cancel",
action: "remove",
target: "Todos.popupController.popup"
}),
addButton: SC.ButtonView.extend({
layout: { width: 80, bottom: 20, height: 21, right: 20 },
title: "Add",
action: "hideAndAdd",
target: "Todos.popupController"
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment