Skip to content

Commit

Permalink
Bump v1.0.18. Add icon options.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsn4ik committed Aug 21, 2014
1 parent 9715666 commit 0cbe80f
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 24 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-checkbox",
"version": "1.0.17",
"version": "1.0.18",
"authors": [
"vsn4ik"
],
Expand Down
20 changes: 17 additions & 3 deletions dist/js/bootstrap-checkbox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Bootstrap-checkbox v1.0.17 (http://vsn4ik.github.io/bootstrap-checkbox)
* Bootstrap-checkbox v1.0.18 (http://vsn4ik.github.io/bootstrap-checkbox)
* Copyright 2013-2014 vsn4ik
* Licensed under MIT (https://github.com/vsn4ik/bootstrap-checkbox/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -39,8 +39,22 @@ if (typeof jQuery === 'undefined') {
Checkboxpicker.prototype = {
init: function() {
this.$element.prop('hidden', true);
this.$off.html(this.options.offLabel);
this.$on.html(this.options.onLabel);

if (this.options.offLabel) {
this.$off.html(this.options.offLabel);
}

if (this.options.onLabel) {
this.$on.html(this.options.onLabel);
}

if (this.options.offIconClass) {
this.$off.prepend('<span class="' + this.options.offIconClass + '"></span>');
}

if (this.options.onIconClass) {
this.$on.prepend('<span class="' + this.options.onIconClass + '"></span>');
}

if (this.element.checked) {
this.$on.addClass('active ' + this.options.onClass);
Expand Down
4 changes: 2 additions & 2 deletions dist/js/bootstrap-checkbox.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1>Bootstrap-checkbox</h1>
<div class="clearfix">
<button id="scroll_top" class="btn btn-primary pull-right" type="button" title="Return to top">
<span class="glyphicon glyphicon-circle-arrow-up"></span>
<span>Top<span>
<span>Top</span>
</button>
</div>

Expand Down
20 changes: 17 additions & 3 deletions docs/dist/js/bootstrap-checkbox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Bootstrap-checkbox v1.0.17 (http://vsn4ik.github.io/bootstrap-checkbox)
* Bootstrap-checkbox v1.0.18 (http://vsn4ik.github.io/bootstrap-checkbox)
* Copyright 2013-2014 vsn4ik
* Licensed under MIT (https://github.com/vsn4ik/bootstrap-checkbox/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -39,8 +39,22 @@ if (typeof jQuery === 'undefined') {
Checkboxpicker.prototype = {
init: function() {
this.$element.prop('hidden', true);
this.$off.html(this.options.offLabel);
this.$on.html(this.options.onLabel);

if (this.options.offLabel) {
this.$off.html(this.options.offLabel);
}

if (this.options.onLabel) {
this.$on.html(this.options.onLabel);
}

if (this.options.offIconClass) {
this.$off.prepend('<span class="' + this.options.offIconClass + '"></span>');
}

if (this.options.onIconClass) {
this.$on.prepend('<span class="' + this.options.onIconClass + '"></span>');
}

if (this.element.checked) {
this.$on.addClass('active ' + this.options.onClass);
Expand Down
4 changes: 2 additions & 2 deletions docs/dist/js/bootstrap-checkbox.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 31 additions & 9 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,37 @@ <h2>Options</h2>
<tr>
<td>defaultClass</td>
<td>string</td>
<td>btn-default</td>
<td>'btn-default'</td>
</tr>
<tr>
<td>offClass</td>
<td>string</td>
<td>btn-danger</td>
<td>'btn-danger'</td>
</tr>
<tr>
<td>onClass</td>
<td>string</td>
<td>btn-success</td>
<td>'btn-success'</td>
</tr>
<tr>
<td>offLabel</td>
<td>string</td>
<td>No</td>
<td>false | string</td>
<td>'No'</td>
</tr>
<tr>
<td>onLabel</td>
<td>string</td>
<td>Yes</td>
<td>false | string</td>
<td>'Yes'</td>
</tr>
<tr>
<td>offIconClass</td>
<td>false | string</td>
<td>false</td>
</tr>
<tr>
<td>onIconClass</td>
<td>false | string</td>
<td>false</td>
</tr>
<tr>
<td>offTitle</td>
Expand Down Expand Up @@ -168,12 +178,24 @@ <h2 id="examples">Examples</h2>

<div class="form-group">
<div class="col-sm-3">
<input type="checkbox" data-off-label="<span class='glyphicon glyphicon-thumbs-down'></span>" data-on-label="<span class='glyphicon glyphicon-thumbs-up'></span>">
<input type="checkbox" data-off-label="<span>No</span>" data-on-label="<span>Yes</span>" data-off-icon-class="glyphicon glyphicon-thumbs-down" data-on-icon-class="glyphicon glyphicon-thumbs-up">
</div>

<div class="col-sm-9">
{% highlight html %}
<input type="checkbox" data-off-icon-class="glyphicon glyphicon-thumbs-down" data-on-icon-class="glyphicon glyphicon-thumbs-up">
{% endhighlight %}
</div>
</div>

<div class="form-group">
<div class="col-sm-3">
<input type="checkbox" data-off-label="false" data-on-label="false" data-off-icon-class="glyphicon glyphicon-thumbs-down" data-on-icon-class="glyphicon glyphicon-thumbs-up">
</div>

<div class="col-sm-9">
{% highlight html %}
<input type="checkbox" data-off-label="<span class='glyphicon glyphicon-thumbs-down'></span>" data-on-label="<span class='glyphicon glyphicon-thumbs-up'></span>">
<input type="checkbox" data-off-label="false" data-on-label="false" data-off-icon-class="glyphicon glyphicon-thumbs-down" data-on-icon-class="glyphicon glyphicon-thumbs-up">
{% endhighlight %}
</div>
</div>
Expand Down
18 changes: 16 additions & 2 deletions js/bootstrap-checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,22 @@ if (typeof jQuery === 'undefined') {
Checkboxpicker.prototype = {
init: function() {
this.$element.prop('hidden', true);
this.$off.html(this.options.offLabel);
this.$on.html(this.options.onLabel);

if (this.options.offLabel) {
this.$off.html(this.options.offLabel);
}

if (this.options.onLabel) {
this.$on.html(this.options.onLabel);
}

if (this.options.offIconClass) {
this.$off.prepend('<span class="' + this.options.offIconClass + '"></span>');
}

if (this.options.onIconClass) {
this.$on.prepend('<span class="' + this.options.onIconClass + '"></span>');
}

if (this.element.checked) {
this.$on.addClass('active ' + this.options.onClass);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-checkbox",
"version": "1.0.17",
"version": "1.0.18",
"description": "A checkbox component based on Bootstrap framework",
"keywords": [
"bootstrap",
Expand Down

0 comments on commit 0cbe80f

Please sign in to comment.