Skip to content

Instantly share code, notes, and snippets.

@SeonghoonKim
Created September 4, 2012 02:23
Show Gist options
  • Save SeonghoonKim/3615834 to your computer and use it in GitHub Desktop.
Save SeonghoonKim/3615834 to your computer and use it in GitHub Desktop.
Bootstrap Modal Dialog용 Marionette Region
// http://twitter.github.com/bootstrap/javascript.html#modals
// http://lostechies.com/derickbailey/2012/04/17/managing-a-modal-dialog-with-backbone-and-marionette/
var ModalRegion = Marionette.Region.extend({
el : '#modal',
onShow : function(view) {
// 'hidden' - Bootstrap Modal event fired when the modal has finished being hidden from the user
this.$el.on('hidden', this.close);
view.on('close', this.hideModal, this);
this.showModal(view);
},
showModal : function(view) {
this.$el.modal('show');
},
hideModal : function() {
this.$el.modal('hide');
}
});
// Region 선언
// - content
// - modal
App.addRegions({
content : '.content',
modal : ModalRegion
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment