Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2012-02-06 12:17:31 +0400
committerJacob Thornton <jacobthornton@gmail.com>2012-02-06 12:17:31 +0400
commitc8c4d5b3925b033723a3f589db9c579b37ca5ceb (patch)
tree3c7d62e87ffc71ab47919a9e45a17cd89bdefd4d
parentf68f7870efd4e56dc1d651dc5de37b265558fce1 (diff)
fix alert tests + add show option back to modals
-rw-r--r--docs/assets/bootstrap.zipbin52355 -> 52400 bytes
-rw-r--r--docs/assets/js/bootstrap-modal.js7
-rw-r--r--docs/javascript.html6
-rw-r--r--docs/templates/pages/javascript.mustache6
-rw-r--r--js/bootstrap-modal.js7
-rw-r--r--js/tests/unit/bootstrap-alert.js4
6 files changed, 22 insertions, 8 deletions
diff --git a/docs/assets/bootstrap.zip b/docs/assets/bootstrap.zip
index 57c5130347..e5a1d8b427 100644
--- a/docs/assets/bootstrap.zip
+++ b/docs/assets/bootstrap.zip
Binary files differ
diff --git a/docs/assets/js/bootstrap-modal.js b/docs/assets/js/bootstrap-modal.js
index ba64368b2d..180f0b64d9 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 2cfe2b9b76..7960a29e39 100644
--- a/docs/javascript.html
+++ b/docs/javascript.html
@@ -273,6 +273,12 @@
<td>true</td>
<td>Closes the modal when escape key is pressed</td>
</tr>
+ <tr>
+ <td>show</td>
+ <td>boolean</td>
+ <td>true</td>
+ <td>Shows the modal when initialized.</td>
+ </tr>
</tbody>
</table>
<h3>Markup</h3>
diff --git a/docs/templates/pages/javascript.mustache b/docs/templates/pages/javascript.mustache
index 111de2350c..57cb4eac42 100644
--- a/docs/templates/pages/javascript.mustache
+++ b/docs/templates/pages/javascript.mustache
@@ -197,6 +197,12 @@
<td>{{_i}}true{{/i}}</td>
<td>{{_i}}Closes the modal when escape key is pressed{{/i}}</td>
</tr>
+ <tr>
+ <td>{{_i}}show{{/i}}</td>
+ <td>{{_i}}boolean{{/i}}</td>
+ <td>{{_i}}true{{/i}}</td>
+ <td>{{_i}}Shows the modal when initialized.{{/i}}</td>
+ </tr>
</tbody>
</table>
<h3>{{_i}}Markup{{/i}}</h3>
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js
index ba64368b2d..180f0b64d9 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 f961345c37..e607f43402 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 = '<div class="alert-message warning fade in">'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
- + '<p><strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.</p>'
+ + '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
+ '</div>'
, alert = $(alertHTML).alert()
@@ -27,7 +27,7 @@ $(function () {
var alertHTML = '<div class="alert-message warning fade in">'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
- + '<p><strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.</p>'
+ + '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
+ '</div>'
, alert = $(alertHTML).appendTo('#qunit-fixture').alert()