Skip to content

Instantly share code, notes, and snippets.

@davidvanleeuwen
Last active December 17, 2015 04:19
Show Gist options
  • Save davidvanleeuwen/5550096 to your computer and use it in GitHub Desktop.
Save davidvanleeuwen/5550096 to your computer and use it in GitHub Desktop.
jQuery(function($) {
// create a layout class
var Layout = Backbone.Marionette.Layout.extend({
template: _.template($('#modals-template').html()),
regions: {
modals: {
selector: '.modals-container',
regionClass: Backbone.Marionette.Modals
}
}
});
// create a modal view class
var Modal = Backbone.Modal.extend({
template: _.template($('#modal-template').html()),
viewContainer: '.modal-view',
views: {
'click #first': {
view: _.template($('#modal-view1-template').html())
},
'click #second': {
view: _.template($('#modal-view2-template').html())
}
}
});
var myLayout = new Layout();
$('body').append(myLayout.render().el);
myLayout.modals.show(new Modal());
myLayout.modals.show(new Modal());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment