vendor/assets/javascripts/bootstrap-modal.js in bootstrap-modal-rails-2.1.1 vs vendor/assets/javascripts/bootstrap-modal.js in bootstrap-modal-rails-2.2.0

- old
+ new

@@ -1,7 +1,7 @@ /* =========================================================== - * bootstrap-modal.js v2.1 + * bootstrap-modal.js v2.2.0 * =========================================================== * Copyright 2012 Jordan Schroter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,16 +31,21 @@ Modal.prototype = { constructor: Modal, init: function (element, options) { + var that = this; + this.options = options; this.$element = $(element) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)); - this.options.remote && this.$element.find('.modal-body').load(this.options.remote); + this.options.remote && this.$element.find('.modal-body').load(this.options.remote, function () { + var e = $.Event('loaded'); + that.$element.trigger(e); + }); var manager = typeof this.options.manager === 'function' ? this.options.manager.call(this) : this.options.manager; manager = manager.appendModal ? @@ -200,23 +205,22 @@ that.hideModal(); }); }, hideModal: function () { - this.$element - .hide() - .trigger('hidden'); - var prop = this.options.height ? 'height' : 'max-height'; var value = this.options.height || this.options.maxHeight; if (value){ this.$element.find('.modal-body') .css('overflow', '') .css(prop, ''); } + this.$element + .hide() + .trigger('hidden'); }, removeLoading: function () { this.$loading.remove(); this.$loading = null; @@ -344,10 +348,11 @@ focusOn: null, replace: false, resize: false, attentionAnimation: 'shake', manager: 'body', - spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>' + spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>', + backdropTemplate: '<div class="modal-backdrop" />' }; $.fn.modal.Constructor = Modal;