2013-05-15 04:17:24 +03:00
|
|
|
"use strict";
|
2013-06-15 08:28:35 +03:00
|
|
|
define(['marionette', 'bootstrap'], function (Marionette) {
|
|
|
|
return Marionette.Region.extend({
|
2013-05-15 04:17:24 +03: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-07 04:29:54 +03:00
|
|
|
showModal: function () {
|
2013-05-15 04:17:24 +03:00
|
|
|
this.$el.addClass('modal hide fade');
|
|
|
|
|
|
|
|
//need tab index so close on escape works
|
|
|
|
//https://github.com/twitter/bootstrap/issues/4663
|
2013-05-27 04:19:26 +03:00
|
|
|
this.$el.attr('tabindex', '-1');
|
2013-06-07 17:34:54 +03:00
|
|
|
this.$el.modal({
|
|
|
|
'show' : true,
|
|
|
|
'keyboard': true,
|
|
|
|
'backdrop': 'static'});
|
2013-05-28 05:05:34 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
closeModal: function () {
|
|
|
|
this.$el.modal('hide');
|
|
|
|
this.close();
|
2013-05-15 04:17:24 +03:00
|
|
|
}
|
2013-05-27 04:19:26 +03:00
|
|
|
|
2013-05-15 04:17:24 +03:00
|
|
|
});
|
2013-06-07 04:29:54 +03:00
|
|
|
});
|