diff --git a/tests/static/checkbox/default.html b/tests/static/checkbox/default.html new file mode 100644 index 00000000000..9d94039171c --- /dev/null +++ b/tests/static/checkbox/default.html @@ -0,0 +1,43 @@ + + + + + Checkbox Static Test : Default + + + + + + + + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + + diff --git a/tests/visual/checkbox/default.html b/tests/visual/checkbox/default.html new file mode 100644 index 00000000000..42315b0220a --- /dev/null +++ b/tests/visual/checkbox/default.html @@ -0,0 +1,32 @@ + + + + + Checkbox Visual Test : Default + + + + + + + + + + +
+ + + + + + + +
+ + + diff --git a/themes/base/jquery.ui.base.css b/themes/base/jquery.ui.base.css index eed06a2772f..b59d2b43fe8 100644 --- a/themes/base/jquery.ui.base.css +++ b/themes/base/jquery.ui.base.css @@ -3,6 +3,7 @@ @import url("jquery.ui.accordion.css"); @import url("jquery.ui.autocomplete.css"); @import url("jquery.ui.button.css"); +@import url("jquery.ui.checkbox.css"); @import url("jquery.ui.datepicker.css"); @import url("jquery.ui.dialog.css"); @import url("jquery.ui.progressbar.css"); diff --git a/themes/base/jquery.ui.checkbox.css b/themes/base/jquery.ui.checkbox.css new file mode 100644 index 00000000000..838e50c3291 --- /dev/null +++ b/themes/base/jquery.ui.checkbox.css @@ -0,0 +1,5 @@ +/* Checkbox +----------------------------------*/ +.ui-checkbox { position: relative; } +.ui-checkbox input { position: absolute; left: 2px; top: 2px; margin: 0; } +.ui-checkbox label { display: block; position: relative; padding-right: 1em; line-height: 1; padding: .5em 0 .5em 30px; margin: 0 0 .3em; cursor: pointer; z-index: 1; } diff --git a/ui/jquery.ui.checkbox.js b/ui/jquery.ui.checkbox.js new file mode 100644 index 00000000000..d02b4916caf --- /dev/null +++ b/ui/jquery.ui.checkbox.js @@ -0,0 +1,59 @@ +/* + * jQuery UI Checkbox @VERSION + * + * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * {{TODO replace with docs link once plugin is released}} + * http://wiki.jqueryui.com/Checkbox + * {{/TODO}} + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function( $ ) { + +$.widget( "ui.checkbox", { + + _create: function() { + + this.labelElement = $( this.element[0].ownerDocument ).find( "label[for=" + this.element.attr("id") + "]" ); + + this.checkboxElement = this.element.wrap( "
" ).parent() + .addClass("ui-checkbox") + .append(this.labelElement); + + }, + + widget: function() { + return this.checkboxElement; + }, + + destroy: function() { + this.checkboxElement + .after( this.labelElement ).end() + .unwrap( "
" ); + + $.Widget.prototype.destroy.apply( this, arguments ); + }, + + _setOption: function( key, value ) { + if ( key === "disabled" ) { + this.element + .attr( "disabled", value ); + this.checkboxElement + [ value ? "addClass" : "removeClass" ]( "ui-checkbox-disabled" ); + } + + $.Widget.prototype._setOption.apply( this, arguments ); + }, + +}); + +$.extend( $.ui.checkbox, { + version: "@VERSION" +}); + +}( jQuery ));