From c8c4d5b3925b033723a3f589db9c579b37ca5ceb Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Mon, 6 Feb 2012 00:17:31 -0800 Subject: fix alert tests + add show option back to modals --- docs/assets/bootstrap.zip | Bin 52355 -> 52400 bytes docs/assets/js/bootstrap-modal.js | 7 ++++--- docs/javascript.html | 6 ++++++ docs/templates/pages/javascript.mustache | 6 ++++++ js/bootstrap-modal.js | 7 ++++--- js/tests/unit/bootstrap-alert.js | 4 ++-- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/docs/assets/bootstrap.zip b/docs/assets/bootstrap.zip index 57c513034..e5a1d8b42 100644 Binary files a/docs/assets/bootstrap.zip and b/docs/assets/bootstrap.zip differ diff --git a/docs/assets/js/bootstrap-modal.js b/docs/assets/js/bootstrap-modal.js index ba64368b2..180f0b64d 100644 --- a/docs/assets/js/bootstrap-modal.js +++ b/docs/assets/js/bootstrap-modal.js @@ -26,7 +26,7 @@ * ====================== */ var Modal = function ( content, options ) { - this.options = $.extend({}, $.fn.modal.defaults, options) + this.options = options this.$element = $(content) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) } @@ -177,16 +177,17 @@ return this.each(function () { var $this = $(this) , data = $this.data('modal') - , options = typeof option == 'object' && option + , options = $.extend({}, $.fn.modal.defaults, typeof option == 'object' && option) if (!data) $this.data('modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option]() - else data.show() + else if (options.show) data.show() }) } $.fn.modal.defaults = { backdrop: true , keyboard: true + , show: true } $.fn.modal.Constructor = Modal diff --git a/docs/javascript.html b/docs/javascript.html index 2cfe2b9b7..7960a29e3 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -273,6 +273,12 @@ true Closes the modal when escape key is pressed + + show + boolean + true + Shows the modal when initialized. +

Markup

diff --git a/docs/templates/pages/javascript.mustache b/docs/templates/pages/javascript.mustache index 111de2350..57cb4eac4 100644 --- a/docs/templates/pages/javascript.mustache +++ b/docs/templates/pages/javascript.mustache @@ -197,6 +197,12 @@ {{_i}}true{{/i}} {{_i}}Closes the modal when escape key is pressed{{/i}} + + {{_i}}show{{/i}} + {{_i}}boolean{{/i}} + {{_i}}true{{/i}} + {{_i}}Shows the modal when initialized.{{/i}} +

{{_i}}Markup{{/i}}

diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index ba64368b2..180f0b64d 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -26,7 +26,7 @@ * ====================== */ var Modal = function ( content, options ) { - this.options = $.extend({}, $.fn.modal.defaults, options) + this.options = options this.$element = $(content) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) } @@ -177,16 +177,17 @@ return this.each(function () { var $this = $(this) , data = $this.data('modal') - , options = typeof option == 'object' && option + , options = $.extend({}, $.fn.modal.defaults, typeof option == 'object' && option) if (!data) $this.data('modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option]() - else data.show() + else if (options.show) data.show() }) } $.fn.modal.defaults = { backdrop: true , keyboard: true + , show: true } $.fn.modal.Constructor = Modal diff --git a/js/tests/unit/bootstrap-alert.js b/js/tests/unit/bootstrap-alert.js index f961345c3..e607f4340 100644 --- a/js/tests/unit/bootstrap-alert.js +++ b/js/tests/unit/bootstrap-alert.js @@ -13,7 +13,7 @@ $(function () { test("should fade element out on clicking .close", function () { var alertHTML = '
' + '×' - + '

Holy guacamole! Best check yo self, you're not looking too good.

' + + '

Holy guacamole! Best check yo self, you\'re not looking too good.

' + '
' , alert = $(alertHTML).alert() @@ -27,7 +27,7 @@ $(function () { var alertHTML = '
' + '×' - + '

Holy guacamole! Best check yo self, you're not looking too good.

' + + '

Holy guacamole! Best check yo self, you\'re not looking too good.

' + '
' , alert = $(alertHTML).appendTo('#qunit-fixture').alert() -- cgit v1.2.3 From 3722bb9a88e95b37ded12cb40a67ac396ce140fd Mon Sep 17 00:00:00 2001 From: raphaelz Date: Tue, 7 Feb 2012 02:11:25 -0500 Subject: Grammatical changes have been made as suggested by @cvrebert for issue #1787. --- js/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/README.md b/js/README.md index b58fa1d40..3aa09c960 100644 --- a/js/README.md +++ b/js/README.md @@ -37,7 +37,7 @@ All methods should accept an optional options object, a string which targets a p Options should be sparse and add universal value. We should pick the right defaults. -All plugins should have a default object which can be modified to effect all instance's default options. The defaults object should be available via `$.fn.plugin.defaults`. +All plugins should have a default object which can be modified to affect all instances' default options. The defaults object should be available via `$.fn.plugin.defaults`. $.fn.modal.defaults = { … } @@ -64,7 +64,7 @@ All events should have an infinitive and past participle form. The infinitive is ### CONSTRUCTORS -Each plugin should expose it's raw constructor on a `Constructor` property -- accessed in the following way: +Each plugin should expose its raw constructor on a `Constructor` property -- accessed in the following way: $.fn.popover.Constructor -- cgit v1.2.3