Created
December 19, 2014 08:47
-
-
Save vanslambrouckd/75c59d24100e14ae53b9 to your computer and use it in GitHub Desktop.
modal region question
This file contains hidden or 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
https://github.com/vanslambrouckd/marionette_test/blob/master/js/region_modal.js | |
<div class="ui modal" id="modal-region"> | |
<i class="close icon"></i> | |
<div class="header"> | |
<%= title %> | |
</div> | |
<div class="content"> | |
<div class="ui medium image"> | |
<img src="/images/avatar/large/chris.jpg"> | |
</div> | |
<div class="description"> | |
<%= content %> | |
</div> | |
</div> | |
<div class="actions"> | |
<div class="ui black button"> | |
Nope | |
</div> | |
<div class="ui positive right labeled icon button"> | |
Yep, that's me | |
<i class="checkmark icon"></i> | |
</div> | |
</div> | |
</div> | |
Marionette.Region.Modal = Marionette.Region.extend({ | |
/* | |
backbone marionette.js a gente introduction p 153 | |
*/ | |
onShow: function(view) { | |
var self = this; | |
this.listenTo(view, 'modal:close', this.closeDialog); | |
ContactManager.modalRegion.show(view); | |
var modalOpts = { | |
closable: false, | |
onDeny: function() { | |
self.closeDialog(); | |
}, | |
} | |
console.log(this.$el); | |
this.$el.modal(modalOpts).modal('show'); | |
}, | |
closeDialog: function() { | |
this.stopListening(); | |
this.close(); | |
this.$el.modal('hide'); | |
} | |
}); | |
var view = new ContactManager.ContactsApp.Edit.Contact({ | |
model: model | |
}); | |
ContactManager.modalRegion.show(view); //replaces #modal-region content with the view, but the view should be inserted into <%= content %> of the modal | |
I want to be able to pass a title and the view as content to the modal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment