Created
December 21, 2012 16:07
-
-
Save isochronous/4353706 to your computer and use it in GitHub Desktop.
PickSitter + Backbone.BabySitter + Marionette Layouts = easy wizard pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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