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