rails-bootstrap-toggle-buttons 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -29,6 +29,22 @@ And to your `application.js`:
|
|
29
29
|
Then follow the [official documentation](http://www.larentis.eu/bootstrap_toggle_buttons/).
|
30
30
|
|
31
31
|
|
32
|
+
### Hacking for simple_forms
|
33
|
+
|
34
|
+
Simple forms add a `label` around the `input type='checkbox'`, and some custom styles too.
|
35
|
+
At first, you will have to add in your `document.ready` event something like the following code:
|
36
|
+
|
37
|
+
$('.control-label.checkbox').toggleButtons();
|
38
|
+
|
39
|
+
But, you will probably get a strange behavior, like an excessive padding. But that's expected. To fix that, add to your css:
|
40
|
+
|
41
|
+
label.boolean.control-label.checkbox.toggle-button {
|
42
|
+
padding-left: 0;
|
43
|
+
}
|
44
|
+
|
45
|
+
This should solve all the issues.
|
46
|
+
|
47
|
+
|
32
48
|
## Contributing
|
33
49
|
|
34
50
|
1. Fork it
|
@@ -0,0 +1,155 @@
|
|
1
|
+
/* line 11, ../sass/bootstrap-toggle-buttons.scss */
|
2
|
+
.toggle-button {
|
3
|
+
display: inline-block;
|
4
|
+
cursor: pointer;
|
5
|
+
-webkit-border-radius: 5px;
|
6
|
+
-moz-border-radius: 5px;
|
7
|
+
-ms-border-radius: 5px;
|
8
|
+
-o-border-radius: 5px;
|
9
|
+
border-radius: 5px;
|
10
|
+
border: 1px solid;
|
11
|
+
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
12
|
+
position: relative;
|
13
|
+
text-align: left;
|
14
|
+
overflow: hidden;
|
15
|
+
-webkit-touch-callout: none;
|
16
|
+
-webkit-user-select: none;
|
17
|
+
-khtml-user-select: none;
|
18
|
+
-moz-user-select: none;
|
19
|
+
-ms-user-select: none;
|
20
|
+
user-select: none;
|
21
|
+
}
|
22
|
+
/* line 29, ../sass/bootstrap-toggle-buttons.scss */
|
23
|
+
.toggle-button.deactivate {
|
24
|
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
|
25
|
+
opacity: 0.5;
|
26
|
+
cursor: default !important;
|
27
|
+
}
|
28
|
+
/* line 32, ../sass/bootstrap-toggle-buttons.scss */
|
29
|
+
.toggle-button.deactivate label, .toggle-button.deactivate span {
|
30
|
+
cursor: default !important;
|
31
|
+
}
|
32
|
+
/* line 36, ../sass/bootstrap-toggle-buttons.scss */
|
33
|
+
.toggle-button > div {
|
34
|
+
display: inline-block;
|
35
|
+
width: 150px;
|
36
|
+
position: absolute;
|
37
|
+
top: 0;
|
38
|
+
}
|
39
|
+
/* line 41, ../sass/bootstrap-toggle-buttons.scss */
|
40
|
+
.toggle-button > div.disabled {
|
41
|
+
left: -50%;
|
42
|
+
}
|
43
|
+
/* line 45, ../sass/bootstrap-toggle-buttons.scss */
|
44
|
+
.toggle-button input[type=checkbox] {
|
45
|
+
display: none;
|
46
|
+
}
|
47
|
+
/* line 53, ../sass/bootstrap-toggle-buttons.scss */
|
48
|
+
.toggle-button span, .toggle-button label {
|
49
|
+
cursor: pointer;
|
50
|
+
position: relative;
|
51
|
+
float: left;
|
52
|
+
display: inline-block;
|
53
|
+
}
|
54
|
+
/* line 60, ../sass/bootstrap-toggle-buttons.scss */
|
55
|
+
.toggle-button label {
|
56
|
+
background: #fefefe;
|
57
|
+
margin-left: -4px;
|
58
|
+
margin-right: -4px;
|
59
|
+
border: 1px solid #E6E6E6;
|
60
|
+
margin-top: -1px;
|
61
|
+
z-index: 100;
|
62
|
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #fefefe), color-stop(100%, #e6e6e6));
|
63
|
+
background-image: -webkit-linear-gradient(top, #fefefe, #e6e6e6);
|
64
|
+
background-image: -moz-linear-gradient(top, #fefefe, #e6e6e6);
|
65
|
+
background-image: -o-linear-gradient(top, #fefefe, #e6e6e6);
|
66
|
+
background-image: linear-gradient(top, #fefefe, #e6e6e6);
|
67
|
+
-webkit-border-radius: 4px;
|
68
|
+
-moz-border-radius: 4px;
|
69
|
+
-ms-border-radius: 4px;
|
70
|
+
-o-border-radius: 4px;
|
71
|
+
border-radius: 4px;
|
72
|
+
}
|
73
|
+
/* line 72, ../sass/bootstrap-toggle-buttons.scss */
|
74
|
+
.toggle-button span {
|
75
|
+
color: #fefefe;
|
76
|
+
text-align: center;
|
77
|
+
font-weight: bold;
|
78
|
+
z-index: 1;
|
79
|
+
}
|
80
|
+
/* line 78, ../sass/bootstrap-toggle-buttons.scss */
|
81
|
+
.toggle-button span.labelLeft {
|
82
|
+
-moz-border-radius-topleft: 4px;
|
83
|
+
-webkit-border-top-left-radius: 4px;
|
84
|
+
border-top-left-radius: 4px;
|
85
|
+
-moz-border-radius-bottomleft: 4px;
|
86
|
+
-webkit-border-bottom-left-radius: 4px;
|
87
|
+
border-bottom-left-radius: 4px;
|
88
|
+
padding-left: 3px;
|
89
|
+
}
|
90
|
+
/* line 83, ../sass/bootstrap-toggle-buttons.scss */
|
91
|
+
.toggle-button span.labelRight {
|
92
|
+
-moz-border-radius-topright: 4px;
|
93
|
+
-webkit-border-top-right-radius: 4px;
|
94
|
+
border-top-right-radius: 4px;
|
95
|
+
-moz-border-radius-bottomright: 4px;
|
96
|
+
-webkit-border-bottom-right-radius: 4px;
|
97
|
+
border-bottom-right-radius: 4px;
|
98
|
+
color: black;
|
99
|
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #fefefe), color-stop(100%, #e6e6e6));
|
100
|
+
background-image: -webkit-linear-gradient(top, #fefefe, #e6e6e6);
|
101
|
+
background-image: -moz-linear-gradient(top, #fefefe, #e6e6e6);
|
102
|
+
background-image: -o-linear-gradient(top, #fefefe, #e6e6e6);
|
103
|
+
background-image: linear-gradient(top, #fefefe, #e6e6e6);
|
104
|
+
padding-right: 3px;
|
105
|
+
}
|
106
|
+
/* line 91, ../sass/bootstrap-toggle-buttons.scss */
|
107
|
+
.toggle-button span.primary, .toggle-button span.labelLeft {
|
108
|
+
color: #fefefe;
|
109
|
+
background: #0088cc;
|
110
|
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0088cc), color-stop(100%, #0055cc));
|
111
|
+
background-image: -webkit-linear-gradient(top, #0088cc, #0055cc);
|
112
|
+
background-image: -moz-linear-gradient(top, #0088cc, #0055cc);
|
113
|
+
background-image: -o-linear-gradient(top, #0088cc, #0055cc);
|
114
|
+
background-image: linear-gradient(top, #0088cc, #0055cc);
|
115
|
+
}
|
116
|
+
/* line 96, ../sass/bootstrap-toggle-buttons.scss */
|
117
|
+
.toggle-button span.info {
|
118
|
+
color: #fefefe;
|
119
|
+
background: #5bc0de;
|
120
|
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #5bc0de), color-stop(100%, #2f96b4));
|
121
|
+
background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4);
|
122
|
+
background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4);
|
123
|
+
background-image: -o-linear-gradient(top, #5bc0de, #2f96b4);
|
124
|
+
background-image: linear-gradient(top, #5bc0de, #2f96b4);
|
125
|
+
}
|
126
|
+
/* line 102, ../sass/bootstrap-toggle-buttons.scss */
|
127
|
+
.toggle-button span.success {
|
128
|
+
color: #fefefe;
|
129
|
+
background: #62c462;
|
130
|
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #62c462), color-stop(100%, #51a351));
|
131
|
+
background-image: -webkit-linear-gradient(top, #62c462, #51a351);
|
132
|
+
background-image: -moz-linear-gradient(top, #62c462, #51a351);
|
133
|
+
background-image: -o-linear-gradient(top, #62c462, #51a351);
|
134
|
+
background-image: linear-gradient(top, #62c462, #51a351);
|
135
|
+
}
|
136
|
+
/* line 108, ../sass/bootstrap-toggle-buttons.scss */
|
137
|
+
.toggle-button span.warning {
|
138
|
+
color: #fefefe;
|
139
|
+
background: #dbb450;
|
140
|
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dbb450), color-stop(100%, #f89406));
|
141
|
+
background-image: -webkit-linear-gradient(top, #dbb450, #f89406);
|
142
|
+
background-image: -moz-linear-gradient(top, #dbb450, #f89406);
|
143
|
+
background-image: -o-linear-gradient(top, #dbb450, #f89406);
|
144
|
+
background-image: linear-gradient(top, #dbb450, #f89406);
|
145
|
+
}
|
146
|
+
/* line 114, ../sass/bootstrap-toggle-buttons.scss */
|
147
|
+
.toggle-button span.danger {
|
148
|
+
color: #fefefe;
|
149
|
+
background: #ee5f5b;
|
150
|
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ee5f5b), color-stop(100%, #bd362f));
|
151
|
+
background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
|
152
|
+
background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
|
153
|
+
background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
|
154
|
+
background-image: linear-gradient(top, #ee5f5b, #bd362f);
|
155
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-bootstrap-toggle-buttons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,23 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2012-10-03 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: compass-rails
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 1.0.3
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.0.3
|
13
|
+
dependencies: []
|
30
14
|
description: Just providing the bootstrap-toggle-buttons from https://github.com/nostalgiaz/bootstrap-toggle-buttons
|
31
15
|
into a gem.
|
32
16
|
email:
|
@@ -37,7 +21,7 @@ extra_rdoc_files: []
|
|
37
21
|
files:
|
38
22
|
- lib/rails-bootstrap-toggle-buttons.rb
|
39
23
|
- vendor/assets/javascripts/bootstrap-toggle-buttons.js
|
40
|
-
- vendor/assets/stylesheets/bootstrap-toggle-buttons.
|
24
|
+
- vendor/assets/stylesheets/bootstrap-toggle-buttons.css
|
41
25
|
- LICENSE.txt
|
42
26
|
- README.md
|
43
27
|
homepage: https://github.com/caarlos0/rails-bootstrap-toggle-buttons.git
|
@@ -1,121 +0,0 @@
|
|
1
|
-
@import "compass/css3";
|
2
|
-
|
3
|
-
// version: 2.3
|
4
|
-
// by Mattia Larentis - follow me on twitter! @SpiritualGuru
|
5
|
-
|
6
|
-
$border: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
7
|
-
$white: #FEFEFE;
|
8
|
-
$blue: #0088CC;
|
9
|
-
$border-radius: 4px;
|
10
|
-
|
11
|
-
.toggle-button {
|
12
|
-
display: inline-block;
|
13
|
-
cursor: pointer;
|
14
|
-
@include border-radius(5px);
|
15
|
-
border: 1px solid;
|
16
|
-
border-color: $border;
|
17
|
-
position: relative;
|
18
|
-
text-align: left;
|
19
|
-
overflow: hidden;
|
20
|
-
|
21
|
-
// disable text selection highlighting
|
22
|
-
-webkit-touch-callout: none;
|
23
|
-
-webkit-user-select: none;
|
24
|
-
-khtml-user-select: none;
|
25
|
-
-moz-user-select: none;
|
26
|
-
-ms-user-select: none;
|
27
|
-
user-select: none;
|
28
|
-
|
29
|
-
&.deactivate {
|
30
|
-
@include opacity(0.5);
|
31
|
-
cursor: default !important;
|
32
|
-
label, span {
|
33
|
-
cursor: default !important;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
> div {
|
37
|
-
display: inline-block;
|
38
|
-
width: 150px;
|
39
|
-
position: absolute;
|
40
|
-
top: 0;
|
41
|
-
&.disabled {
|
42
|
-
left: -50%;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
input[type=checkbox] {
|
46
|
-
//debug
|
47
|
-
display: none;
|
48
|
-
//position: absolute;
|
49
|
-
//margin-left: 60%;
|
50
|
-
//z-index: 123;
|
51
|
-
}
|
52
|
-
|
53
|
-
span, label {
|
54
|
-
cursor: pointer;
|
55
|
-
position: relative;
|
56
|
-
float: left;
|
57
|
-
display: inline-block;
|
58
|
-
}
|
59
|
-
|
60
|
-
label {
|
61
|
-
background: $white;
|
62
|
-
margin-left: -$border-radius;
|
63
|
-
margin-right: -$border-radius;
|
64
|
-
border: 1px solid #E6E6E6;
|
65
|
-
margin-top: -1px;
|
66
|
-
z-index: 100;
|
67
|
-
|
68
|
-
@include background-image(linear-gradient(top, $white, #E6E6E6));
|
69
|
-
@include border-radius($border-radius);
|
70
|
-
}
|
71
|
-
|
72
|
-
span {
|
73
|
-
color: $white;
|
74
|
-
text-align: center;
|
75
|
-
font-weight: bold;
|
76
|
-
z-index: 1;
|
77
|
-
|
78
|
-
&.labelLeft {
|
79
|
-
@include border-top-left-radius($border-radius);
|
80
|
-
@include border-bottom-left-radius($border-radius);
|
81
|
-
padding-left: 3px;
|
82
|
-
}
|
83
|
-
&.labelRight {
|
84
|
-
@include border-top-right-radius($border-radius);
|
85
|
-
@include border-bottom-right-radius($border-radius);
|
86
|
-
color: black;
|
87
|
-
@include background-image(linear-gradient(top, $white, #E6E6E6));
|
88
|
-
padding-right: 3px;
|
89
|
-
}
|
90
|
-
|
91
|
-
&.primary, &.labelLeft {
|
92
|
-
color: $white;
|
93
|
-
background: $blue;
|
94
|
-
@include background-image(linear-gradient(top, $blue, #0055CC));
|
95
|
-
}
|
96
|
-
&.info {
|
97
|
-
$startColor: #5BC0DE;
|
98
|
-
color: $white;
|
99
|
-
background: $startColor;
|
100
|
-
@include background-image(linear-gradient(top, $startColor, #2F96B4));
|
101
|
-
}
|
102
|
-
&.success {
|
103
|
-
$startColor: #62C462;
|
104
|
-
color: $white;
|
105
|
-
background: $startColor;
|
106
|
-
@include background-image(linear-gradient(top, $startColor, #51A351));
|
107
|
-
}
|
108
|
-
&.warning {
|
109
|
-
$startColor: #DBB450;
|
110
|
-
color: $white;
|
111
|
-
background: $startColor;
|
112
|
-
@include background-image(linear-gradient(top, $startColor, #F89406));
|
113
|
-
}
|
114
|
-
&.danger {
|
115
|
-
$startColor: #EE5f5B;
|
116
|
-
color: $white;
|
117
|
-
background: $startColor;
|
118
|
-
@include background-image(linear-gradient(top, $startColor, #BD362F));
|
119
|
-
}
|
120
|
-
}
|
121
|
-
}
|