2013-06-22 09:24:24 +03:00
|
|
|
'use strict';
|
2013-06-22 03:48:23 +03:00
|
|
|
define(
|
|
|
|
[
|
2013-06-27 02:45:05 +03:00
|
|
|
'$',
|
2013-06-22 03:48:23 +03:00
|
|
|
'marionette',
|
|
|
|
'bootstrap'
|
2013-06-27 02:45:05 +03:00
|
|
|
], function ($, Marionette) {
|
2013-06-22 03:48:23 +03:00
|
|
|
return Marionette.Region.extend({
|
2013-06-22 09:24:24 +03:00
|
|
|
el: '#modal-region',
|
2013-05-27 04:19:26 +03:00
|
|
|
|
2013-06-22 03:48:23 +03:00
|
|
|
constructor: function () {
|
|
|
|
Backbone.Marionette.Region.prototype.constructor.apply(this, arguments);
|
2013-06-22 09:24:24 +03:00
|
|
|
this.on('show', this.showModal, this);
|
2013-06-22 03:48:23 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
getEl: function (selector) {
|
|
|
|
var $el = $(selector);
|
2013-06-22 09:24:24 +03:00
|
|
|
$el.on('hidden', this.close);
|
2013-06-22 03:48:23 +03: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'});
|
|
|
|
},
|
|
|
|
|
|
|
|
closeModal: function () {
|
2013-06-27 02:45:05 +03:00
|
|
|
$(this.el).modal('hide');
|
|
|
|
this.reset();
|
2013-06-22 03:48:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2013-05-15 04:17:24 +03:00
|
|
|
});
|