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.

Revisions

  1. SeonghoonKim created this gist Sep 4, 2012.
    28 changes: 28 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    // 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
    });