]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
fix alert tests + add show option back to modals
authorJacob Thornton <jacobthornton@gmail.com>
Mon, 6 Feb 2012 08:17:31 +0000 (00:17 -0800)
committerJacob Thornton <jacobthornton@gmail.com>
Mon, 6 Feb 2012 08:17:31 +0000 (00:17 -0800)
docs/assets/bootstrap.zip
docs/assets/js/bootstrap-modal.js
docs/javascript.html
docs/templates/pages/javascript.mustache
js/bootstrap-modal.js
js/tests/unit/bootstrap-alert.js

index 57c5130347fc21c3031d2953b3497406b330aa79..e5a1d8b427b04db41b8150479ed7594f17837031 100644 (file)
Binary files a/docs/assets/bootstrap.zip and b/docs/assets/bootstrap.zip differ
index ba64368b2d48301ac07ce664704223642c4614d1..180f0b64d9a8e948614a602443827fbf8533f9dc 100644 (file)
@@ -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))
   }
     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
index 2cfe2b9b76b3cc3c5880821718daa6398176c03a..7960a29e39f8fadbf0f2dd67b8147c203c8a5c3f 100644 (file)
                <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>
index 111de2350c48fbdd4c4bdfeeb9e41e1d3de576bc..57cb4eac421c1d971dab2cd4f56155024beaa25c 100644 (file)
                <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>
index ba64368b2d48301ac07ce664704223642c4614d1..180f0b64d9a8e948614a602443827fbf8533f9dc 100644 (file)
@@ -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))
   }
     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
index f961345c3754440556ecf223cd5a2c0e48d873db..e607f43402fe48aa32351a5ff59da27ab6b0bc57 100644 (file)
@@ -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()