2013-06-22 06:24:24 +00:00
|
|
|
'use strict';
|
2013-06-22 00:48:23 +00:00
|
|
|
define(
|
|
|
|
[
|
|
|
|
'marionette',
|
|
|
|
'bootstrap'
|
|
|
|
], function (Marionette) {
|
|
|
|
return Marionette.Region.extend({
|
2013-06-22 06:24:24 +00:00
|
|
|
el: '#modal-region',
|
2013-05-27 01:19:26 +00:00
|
|
|
|
2013-06-22 00:48:23 +00:00
|
|
|
constructor: function () {
|
|
|
|
Backbone.Marionette.Region.prototype.constructor.apply(this, arguments);
|
2013-06-22 06:24:24 +00:00
|
|
|
this.on('show', this.showModal, this);
|
2013-06-22 00:48:23 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
getEl: function (selector) {
|
|
|
|
var $el = $(selector);
|
2013-06-22 06:24:24 +00:00
|
|
|
$el.on('hidden', this.close);
|
2013-06-22 00:48:23 +00:00
|
|
|
return $el;
|
|
|
|
},
|
|
|
|
|
|
|
|
showModal: function () {
|
|
|
|
this.$el.addClass('modal hide fade');
|
|
|
|
|
|
|
|
//need tab index so close on escape works
|
|
|
|
//https://github.com/twitter/bootstrap/issues/4663
|
|
|
|
this.$el.attr('tabindex', '-1');
|
|
|
|
this.$el.modal({
|
|
|
|
'show' : true,
|
|
|
|
'keyboard': true,
|
|
|
|
'backdrop': 'static'});
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onClose: function(){
|
|
|
|
this.closeModal();
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
closeModal: function () {
|
|
|
|
this.$el.modal('hide');
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2013-05-15 01:17:24 +00:00
|
|
|
});
|