Created
September 4, 2012 02:23
-
-
Save SeonghoonKim/3615834 to your computer and use it in GitHub Desktop.
Bootstrap Modal Dialog용 Marionette Region
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
// 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