Skip to content

Instantly share code, notes, and snippets.

@isochronous
Created December 21, 2012 16:07
Show Gist options
  • Save isochronous/4353706 to your computer and use it in GitHub Desktop.
Save isochronous/4353706 to your computer and use it in GitHub Desktop.
PickSitter + Backbone.BabySitter + Marionette Layouts = easy wizard pattern
var SelectView = Marionette.ItemView.extend({
initialize: function(options) {
this.bindTo(this, "selected", onSelect);
this.bindTo(this, "deselected", onDeselect);
},
onSelect: function() {
this.model.fetch();
},
onDeselect: function() {
this.model.save();
}
});
var viewCont = new SelectableContainer();
// add some SelectViews
var myLayout = new Marionette.Layout({
regions: {
childRegion: "#myRegionId"
},
template: someTemplate,
childViews: viewCont,
initialize: function(options) {
this.bindTo(viewCont, "select", showChildView, this);
},
showChildView(view) {
this.childRegion.show(view);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment