Skip to content

Commit

Permalink
Merge pull request flatlogic#40 from UseFedora/master
Browse files Browse the repository at this point in the history
allow radios to be displayed as checkboxes (flatlogic#10)
  • Loading branch information
okendoken committed May 28, 2015
2 parents 60e6159 + dfac8f7 commit 9b7dc86
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 226 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.sass-cache
68 changes: 49 additions & 19 deletions awesome-bootstrap-checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,28 @@
font-size: 11px;
color: #555555;
}
.checkbox input[type="checkbox"] {
.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
opacity: 0;
z-index: 1;
}
.checkbox input[type="checkbox"]:focus + label::before {
.checkbox input[type="checkbox"]:focus + label::before,
.checkbox input[type="radio"]:focus + label::before {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.checkbox input[type="checkbox"]:checked + label::after {
font-family: 'FontAwesome';
.checkbox input[type="checkbox"]:checked + label::after,
.checkbox input[type="radio"]:checked + label::after {
font-family: "FontAwesome";
content: "\f00c";
}
.checkbox input[type="checkbox"]:disabled + label {
.checkbox input[type="checkbox"]:disabled + label,
.checkbox input[type="radio"]:disabled + label {
opacity: 0.65;
}
.checkbox input[type="checkbox"]:disabled + label::before {
.checkbox input[type="checkbox"]:disabled + label::before,
.checkbox input[type="radio"]:disabled + label::before {
background-color: #eeeeee;
cursor: not-allowed;
}
Expand All @@ -61,41 +66,57 @@
.checkbox.checkbox-inline {
margin-top: 0;
}
.checkbox-primary input[type="checkbox"]:checked + label::before {

.checkbox-primary input[type="checkbox"]:checked + label::before,
.checkbox-primary input[type="radio"]:checked + label::before {
background-color: #337ab7;
border-color: #337ab7;
}
.checkbox-primary input[type="checkbox"]:checked + label::after {
.checkbox-primary input[type="checkbox"]:checked + label::after,
.checkbox-primary input[type="radio"]:checked + label::after {
color: #fff;
}
.checkbox-danger input[type="checkbox"]:checked + label::before {

.checkbox-danger input[type="checkbox"]:checked + label::before,
.checkbox-danger input[type="radio"]:checked + label::before {
background-color: #d9534f;
border-color: #d9534f;
}
.checkbox-danger input[type="checkbox"]:checked + label::after {
.checkbox-danger input[type="checkbox"]:checked + label::after,
.checkbox-danger input[type="radio"]:checked + label::after {
color: #fff;
}
.checkbox-info input[type="checkbox"]:checked + label::before {

.checkbox-info input[type="checkbox"]:checked + label::before,
.checkbox-info input[type="radio"]:checked + label::before {
background-color: #5bc0de;
border-color: #5bc0de;
}
.checkbox-info input[type="checkbox"]:checked + label::after {
.checkbox-info input[type="checkbox"]:checked + label::after,
.checkbox-info input[type="radio"]:checked + label::after {
color: #fff;
}
.checkbox-warning input[type="checkbox"]:checked + label::before {

.checkbox-warning input[type="checkbox"]:checked + label::before,
.checkbox-warning input[type="radio"]:checked + label::before {
background-color: #f0ad4e;
border-color: #f0ad4e;
}
.checkbox-warning input[type="checkbox"]:checked + label::after {
.checkbox-warning input[type="checkbox"]:checked + label::after,
.checkbox-warning input[type="radio"]:checked + label::after {
color: #fff;
}
.checkbox-success input[type="checkbox"]:checked + label::before {

.checkbox-success input[type="checkbox"]:checked + label::before,
.checkbox-success input[type="radio"]:checked + label::before {
background-color: #5cb85c;
border-color: #5cb85c;
}
.checkbox-success input[type="checkbox"]:checked + label::after {
.checkbox-success input[type="checkbox"]:checked + label::after,
.checkbox-success input[type="radio"]:checked + label::after {
color: #fff;
}

.radio {
padding-left: 20px;
}
Expand Down Expand Up @@ -164,6 +185,7 @@
.radio.radio-inline {
margin-top: 0;
}

.radio-primary input[type="radio"] + label::after {
background-color: #337ab7;
}
Expand All @@ -173,6 +195,7 @@
.radio-primary input[type="radio"]:checked + label::after {
background-color: #337ab7;
}

.radio-danger input[type="radio"] + label::after {
background-color: #d9534f;
}
Expand All @@ -182,6 +205,7 @@
.radio-danger input[type="radio"]:checked + label::after {
background-color: #d9534f;
}

.radio-info input[type="radio"] + label::after {
background-color: #5bc0de;
}
Expand All @@ -191,6 +215,7 @@
.radio-info input[type="radio"]:checked + label::after {
background-color: #5bc0de;
}

.radio-warning input[type="radio"] + label::after {
background-color: #f0ad4e;
}
Expand All @@ -200,6 +225,7 @@
.radio-warning input[type="radio"]:checked + label::after {
background-color: #f0ad4e;
}

.radio-success input[type="radio"] + label::after {
background-color: #5cb85c;
}
Expand All @@ -209,13 +235,17 @@
.radio-success input[type="radio"]:checked + label::after {
background-color: #5cb85c;
}
input[type="checkbox"].styled:checked + label:after {

input[type="checkbox"].styled:checked + label:after,
input[type="radio"].styled:checked + label:after {
font-family: 'FontAwesome';
content: "\f00c";
}
input[type="checkbox"] .styled:checked + label::before {
input[type="checkbox"] .styled:checked + label::before,
input[type="radio"] .styled:checked + label::before {
color: #fff;
}
input[type="checkbox"] .styled:checked + label::after {
input[type="checkbox"] .styled:checked + label::after,
input[type="radio"] .styled:checked + label::after {
color: #fff;
}
11 changes: 7 additions & 4 deletions awesome-bootstrap-checkbox.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
@font-family-icon: 'FontAwesome';

.checkbox-variant(@parent, @color) {
.@{parent} input[type="checkbox"]:checked + label {
.@{parent} input[type="checkbox"]:checked + label,
.@{parent} input[type="radio"]:checked + label {
&::before {
background-color: @color;
border-color: @color;
Expand Down Expand Up @@ -55,7 +56,8 @@
}
}

input[type="checkbox"]{
input[type="checkbox"],
input[type="radio"]{
opacity: 0;
z-index: 1;

Expand Down Expand Up @@ -190,7 +192,8 @@
.radio-variant(radio-warning, @brand-warning);
.radio-variant(radio-success, @brand-success);

input[type="checkbox"] {
input[type="checkbox"],
input[type="radio"] {
&.styled:checked + label:after {
font-family: 'FontAwesome';
content: "\f00c";
Expand All @@ -203,4 +206,4 @@ input[type="checkbox"] {
color: #fff;
}
}
}
}
12 changes: 8 additions & 4 deletions awesome-bootstrap-checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// Checkboxes
// --------------------------------------------------


$font-family-icon: 'FontAwesome' !default;

@mixin checkbox-variant($parent, $color) {
#{$parent} input[type="checkbox"]:checked + label{
#{$parent} input[type="checkbox"]:checked + label,
#{$parent} input[type="radio"]:checked + label {
&::before {
background-color: $color;
border-color: $color;
Expand Down Expand Up @@ -55,7 +57,8 @@ $font-family-icon: 'FontAwesome' !default;
}
}

input[type="checkbox"]{
input[type="checkbox"],
input[type="radio"] {
opacity: 0;
z-index: 1;

Expand Down Expand Up @@ -191,7 +194,8 @@ $font-family-icon: 'FontAwesome' !default;
@include radio-variant('.radio-success', $brand-success);


input[type="checkbox"] {
input[type="checkbox"],
input[type="radio"] {
&.styled:checked + label:after {
font-family: 'FontAwesome';
content: "\f00c";
Expand All @@ -204,4 +208,4 @@ input[type="checkbox"] {
color: #fff;
}
}
}
}
Loading

0 comments on commit 9b7dc86

Please sign in to comment.