bootstrap-toggle-rails 2.2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 47b80ab53665ae277df517c184a090fbdc3d90e3
4
+ data.tar.gz: 6c70ade8233eafec6f5396d44c3eb2943b29d0e1
5
+ SHA512:
6
+ metadata.gz: 1cfec6ac6c0d2a1aec6806ecee97408a7e2c1f4d54de530d2851c9f6c060b4f0017922824f92bfb1d6a1a1e83f20419d24ed4daada0e885713d480ed1fd4ab82
7
+ data.tar.gz: 896c641f41a1f7a30db68901df095bb7cfb5d9c03f0be7cb84f88c0813dd076fa3f6223380204ad5151fb3db6f31af1270f4be5c3d8ea13a6c80e84c5f343cdb
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bootstrap-toggle-rails.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Raphael Kallensee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,86 @@
1
+ [![Gem Version](http://badge.fury.io/rb/bootstrap-toggle-rails.png)](http://badge.fury.io/rb/bootstrap-toggle-rails)
2
+
3
+ # Bootstrap Toggle Rails
4
+
5
+ [Bootstrap Toggle](http://www.bootstraptoggle.com/) is a highly flexible Bootstrap plugin that converts checkboxes into toggles.
6
+
7
+ `bootstrap-toggle-rails` is an unofficial gem which integrates this Bootstrap plugin with the Rails asset pipeline.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'bootstrap-toggle-rails'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install bootstrap-toggle-rails
24
+
25
+ ## Usage
26
+
27
+ To load the required assets in your application add the appropriate line to your application.js/application.css (depending on whether you use Bootstrap in version 3 or 2):
28
+
29
+ `app/assets/javascripts/application.js`:
30
+
31
+ ```javascript
32
+ //= require bootstrap-toggle
33
+ ```
34
+
35
+ or in case of Bootstrap 2:
36
+
37
+ ```javascript
38
+ //= require bootstrap2-toggle
39
+ ```
40
+
41
+ `app/assets/stylesheets/application.css`:
42
+
43
+ ```
44
+ *= require bootstrap-toggle
45
+ ```
46
+
47
+ or in case of Bootstrap 2:
48
+
49
+ ```
50
+ *= require bootstrap2-toggle
51
+ ```
52
+
53
+ ### Initialization
54
+
55
+ To replace a checkbox with toggles just add the `data-toggle="toggle"` attribute to the checkbox, e.g.:
56
+
57
+ ```html
58
+ <input type="checkbox" checked data-toggle="toggle">
59
+ ```
60
+
61
+ Remember: this kind of initialization does not seem to be compatible to [Turbolinks](). If you use Turbolinks you should manually initialize with JavaScript and also attach the `page:change` event fired by Turbolinks, e.g.:
62
+
63
+ ```javascript
64
+ $(document).on('ready page:change', function() {
65
+ $('input[type="checkbox"].toggle').bootstrapToggle(); // assumes the checkboxes have the class "toggle"
66
+ });
67
+ ```
68
+
69
+ For more documentation see [bootstraptoggle.com](http://www.bootstraptoggle.com/) or their [Github project](https://github.com/minhur/bootstrap-toggle/).
70
+
71
+
72
+ ## Development
73
+
74
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
75
+
76
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
77
+
78
+ ## Contributing
79
+
80
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rkallensee/bootstrap-toggle-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
81
+
82
+
83
+ ## License
84
+
85
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT), just as the "Bootstrap Toggle" plugin itself.
86
+
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,180 @@
1
+ /*! ========================================================================
2
+ * Bootstrap Toggle: bootstrap-toggle.js v2.2.0
3
+ * http://www.bootstraptoggle.com
4
+ * ========================================================================
5
+ * Copyright 2014 Min Hur, The New York Times Company
6
+ * Licensed under MIT
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // TOGGLE PUBLIC CLASS DEFINITION
14
+ // ==============================
15
+
16
+ var Toggle = function (element, options) {
17
+ this.$element = $(element)
18
+ this.options = $.extend({}, this.defaults(), options)
19
+ this.render()
20
+ }
21
+
22
+ Toggle.VERSION = '2.2.0'
23
+
24
+ Toggle.DEFAULTS = {
25
+ on: 'On',
26
+ off: 'Off',
27
+ onstyle: 'primary',
28
+ offstyle: 'default',
29
+ size: 'normal',
30
+ style: '',
31
+ width: null,
32
+ height: null
33
+ }
34
+
35
+ Toggle.prototype.defaults = function() {
36
+ return {
37
+ on: this.$element.attr('data-on') || Toggle.DEFAULTS.on,
38
+ off: this.$element.attr('data-off') || Toggle.DEFAULTS.off,
39
+ onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle,
40
+ offstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle,
41
+ size: this.$element.attr('data-size') || Toggle.DEFAULTS.size,
42
+ style: this.$element.attr('data-style') || Toggle.DEFAULTS.style,
43
+ width: this.$element.attr('data-width') || Toggle.DEFAULTS.width,
44
+ height: this.$element.attr('data-height') || Toggle.DEFAULTS.height
45
+ }
46
+ }
47
+
48
+ Toggle.prototype.render = function () {
49
+ this._onstyle = 'btn-' + this.options.onstyle
50
+ this._offstyle = 'btn-' + this.options.offstyle
51
+ var size = this.options.size === 'large' ? 'btn-lg'
52
+ : this.options.size === 'small' ? 'btn-sm'
53
+ : this.options.size === 'mini' ? 'btn-xs'
54
+ : ''
55
+ var $toggleOn = $('<label class="btn">').html(this.options.on)
56
+ .addClass(this._onstyle + ' ' + size)
57
+ var $toggleOff = $('<label class="btn">').html(this.options.off)
58
+ .addClass(this._offstyle + ' ' + size + ' active')
59
+ var $toggleHandle = $('<span class="toggle-handle btn btn-default">')
60
+ .addClass(size)
61
+ var $toggleGroup = $('<div class="toggle-group">')
62
+ .append($toggleOn, $toggleOff, $toggleHandle)
63
+ var $toggle = $('<div class="toggle btn" data-toggle="toggle">')
64
+ .addClass( this.$element.prop('checked') ? this._onstyle : this._offstyle+' off' )
65
+ .addClass(size).addClass(this.options.style)
66
+
67
+ this.$element.wrap($toggle)
68
+ $.extend(this, {
69
+ $toggle: this.$element.parent(),
70
+ $toggleOn: $toggleOn,
71
+ $toggleOff: $toggleOff,
72
+ $toggleGroup: $toggleGroup
73
+ })
74
+ this.$toggle.append($toggleGroup)
75
+
76
+ var width = this.options.width || Math.max($toggleOn.outerWidth(), $toggleOff.outerWidth())+($toggleHandle.outerWidth()/2)
77
+ var height = this.options.height || Math.max($toggleOn.outerHeight(), $toggleOff.outerHeight())
78
+ $toggleOn.addClass('toggle-on')
79
+ $toggleOff.addClass('toggle-off')
80
+ this.$toggle.css({ width: width, height: height })
81
+ if (this.options.height) {
82
+ $toggleOn.css('line-height', $toggleOn.height() + 'px')
83
+ $toggleOff.css('line-height', $toggleOff.height() + 'px')
84
+ }
85
+ this.update(true)
86
+ this.trigger(true)
87
+ }
88
+
89
+ Toggle.prototype.toggle = function () {
90
+ if (this.$element.prop('checked')) this.off()
91
+ else this.on()
92
+ }
93
+
94
+ Toggle.prototype.on = function (silent) {
95
+ if (this.$element.prop('disabled')) return false
96
+ this.$toggle.removeClass(this._offstyle + ' off').addClass(this._onstyle)
97
+ this.$element.prop('checked', true)
98
+ if (!silent) this.trigger()
99
+ }
100
+
101
+ Toggle.prototype.off = function (silent) {
102
+ if (this.$element.prop('disabled')) return false
103
+ this.$toggle.removeClass(this._onstyle).addClass(this._offstyle + ' off')
104
+ this.$element.prop('checked', false)
105
+ if (!silent) this.trigger()
106
+ }
107
+
108
+ Toggle.prototype.enable = function () {
109
+ this.$toggle.removeAttr('disabled')
110
+ this.$element.prop('disabled', false)
111
+ }
112
+
113
+ Toggle.prototype.disable = function () {
114
+ this.$toggle.attr('disabled', 'disabled')
115
+ this.$element.prop('disabled', true)
116
+ }
117
+
118
+ Toggle.prototype.update = function (silent) {
119
+ if (this.$element.prop('disabled')) this.disable()
120
+ else this.enable()
121
+ if (this.$element.prop('checked')) this.on(silent)
122
+ else this.off(silent)
123
+ }
124
+
125
+ Toggle.prototype.trigger = function (silent) {
126
+ this.$element.off('change.bs.toggle')
127
+ if (!silent) this.$element.change()
128
+ this.$element.on('change.bs.toggle', $.proxy(function() {
129
+ this.update()
130
+ }, this))
131
+ }
132
+
133
+ Toggle.prototype.destroy = function() {
134
+ this.$element.off('change.bs.toggle')
135
+ this.$toggleGroup.remove()
136
+ this.$element.removeData('bs.toggle')
137
+ this.$element.unwrap()
138
+ }
139
+
140
+ // TOGGLE PLUGIN DEFINITION
141
+ // ========================
142
+
143
+ function Plugin(option) {
144
+ return this.each(function () {
145
+ var $this = $(this)
146
+ var data = $this.data('bs.toggle')
147
+ var options = typeof option == 'object' && option
148
+
149
+ if (!data) $this.data('bs.toggle', (data = new Toggle(this, options)))
150
+ if (typeof option == 'string' && data[option]) data[option]()
151
+ })
152
+ }
153
+
154
+ var old = $.fn.bootstrapToggle
155
+
156
+ $.fn.bootstrapToggle = Plugin
157
+ $.fn.bootstrapToggle.Constructor = Toggle
158
+
159
+ // TOGGLE NO CONFLICT
160
+ // ==================
161
+
162
+ $.fn.toggle.noConflict = function () {
163
+ $.fn.bootstrapToggle = old
164
+ return this
165
+ }
166
+
167
+ // TOGGLE DATA-API
168
+ // ===============
169
+
170
+ $(function() {
171
+ $('input[type=checkbox][data-toggle^=toggle]').bootstrapToggle()
172
+ })
173
+
174
+ $(document).on('click.bs.toggle', 'div[data-toggle^=toggle]', function(e) {
175
+ var $checkbox = $(this).find('input[type=checkbox]')
176
+ $checkbox.bootstrapToggle('toggle')
177
+ e.preventDefault()
178
+ })
179
+
180
+ }(jQuery);
@@ -0,0 +1,180 @@
1
+ /*! ========================================================================
2
+ * Bootstrap Toggle: bootstrap2-toggle.js v2.2.0
3
+ * http://www.bootstraptoggle.com
4
+ * ========================================================================
5
+ * Copyright 2014 Min Hur, The New York Times Company
6
+ * Licensed under MIT
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // TOGGLE PUBLIC CLASS DEFINITION
14
+ // ==============================
15
+
16
+ var Toggle = function (element, options) {
17
+ this.$element = $(element)
18
+ this.options = $.extend({}, this.defaults(), options)
19
+ this.render()
20
+ }
21
+
22
+ Toggle.VERSION = '2.2.0'
23
+
24
+ Toggle.DEFAULTS = {
25
+ on: 'On',
26
+ off: 'Off',
27
+ onstyle: 'primary',
28
+ offstyle: 'default',
29
+ size: 'normal',
30
+ style: '',
31
+ width: null,
32
+ height: null
33
+ }
34
+
35
+ Toggle.prototype.defaults = function() {
36
+ return {
37
+ on: this.$element.attr('data-on') || Toggle.DEFAULTS.on,
38
+ off: this.$element.attr('data-off') || Toggle.DEFAULTS.off,
39
+ onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle,
40
+ offstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle,
41
+ size: this.$element.attr('data-size') || Toggle.DEFAULTS.size,
42
+ style: this.$element.attr('data-style') || Toggle.DEFAULTS.style,
43
+ width: this.$element.attr('data-width') || Toggle.DEFAULTS.width,
44
+ height: this.$element.attr('data-height') || Toggle.DEFAULTS.height
45
+ }
46
+ }
47
+
48
+ Toggle.prototype.render = function () {
49
+ this._onstyle = 'btn-' + this.options.onstyle
50
+ this._offstyle = 'btn-' + this.options.offstyle
51
+ var size = this.options.size === 'large' ? 'btn-large'
52
+ : this.options.size === 'small' ? 'btn-small'
53
+ : this.options.size === 'mini' ? 'btn-mini'
54
+ : ''
55
+ var $toggleOn = $('<label class="btn">').html(this.options.on)
56
+ .addClass(this._onstyle + ' ' + size)
57
+ var $toggleOff = $('<label class="btn">').html(this.options.off)
58
+ .addClass(this._offstyle + ' ' + size + ' active')
59
+ var $toggleHandle = $('<span class="toggle-handle btn btn-default">')
60
+ .addClass(size)
61
+ var $toggleGroup = $('<div class="toggle-group">')
62
+ .append($toggleOn, $toggleOff, $toggleHandle)
63
+ var $toggle = $('<div class="toggle btn" data-toggle="toggle">')
64
+ .addClass( this.$element.prop('checked') ? this._onstyle : this._offstyle+' off' )
65
+ .addClass(size).addClass(this.options.style)
66
+
67
+ this.$element.wrap($toggle)
68
+ $.extend(this, {
69
+ $toggle: this.$element.parent(),
70
+ $toggleOn: $toggleOn,
71
+ $toggleOff: $toggleOff,
72
+ $toggleGroup: $toggleGroup
73
+ })
74
+ this.$toggle.append($toggleGroup)
75
+
76
+ var width = this.options.width || Math.max($toggleOn.width(), $toggleOff.width())+($toggleHandle.outerWidth()/2)
77
+ var height = this.options.height || Math.max($toggleOn.height(), $toggleOff.height())
78
+ $toggleOn.addClass('toggle-on')
79
+ $toggleOff.addClass('toggle-off')
80
+ this.$toggle.css({ width: width, height: height })
81
+ if (this.options.height) {
82
+ $toggleOn.css('line-height', $toggleOn.height() + 'px')
83
+ $toggleOff.css('line-height', $toggleOff.height() + 'px')
84
+ }
85
+ this.update(true)
86
+ this.trigger(true)
87
+ }
88
+
89
+ Toggle.prototype.toggle = function () {
90
+ if (this.$element.prop('checked')) this.off()
91
+ else this.on()
92
+ }
93
+
94
+ Toggle.prototype.on = function (silent) {
95
+ if (this.$element.prop('disabled')) return false
96
+ this.$toggle.removeClass(this._offstyle + ' off').addClass(this._onstyle)
97
+ this.$element.prop('checked', true)
98
+ if (!silent) this.trigger()
99
+ }
100
+
101
+ Toggle.prototype.off = function (silent) {
102
+ if (this.$element.prop('disabled')) return false
103
+ this.$toggle.removeClass(this._onstyle).addClass(this._offstyle + ' off')
104
+ this.$element.prop('checked', false)
105
+ if (!silent) this.trigger()
106
+ }
107
+
108
+ Toggle.prototype.enable = function () {
109
+ this.$toggle.removeAttr('disabled')
110
+ this.$element.prop('disabled', false)
111
+ }
112
+
113
+ Toggle.prototype.disable = function () {
114
+ this.$toggle.attr('disabled', 'disabled')
115
+ this.$element.prop('disabled', true)
116
+ }
117
+
118
+ Toggle.prototype.update = function (silent) {
119
+ if (this.$element.prop('disabled')) this.disable()
120
+ else this.enable()
121
+ if (this.$element.prop('checked')) this.on(silent)
122
+ else this.off(silent)
123
+ }
124
+
125
+ Toggle.prototype.trigger = function (silent) {
126
+ this.$element.off('change.bs.toggle')
127
+ if (!silent) this.$element.change()
128
+ this.$element.on('change.bs.toggle', $.proxy(function() {
129
+ this.update()
130
+ }, this))
131
+ }
132
+
133
+ Toggle.prototype.destroy = function() {
134
+ this.$element.off('change.bs.toggle')
135
+ this.$toggleGroup.remove()
136
+ this.$element.removeData('bs.toggle')
137
+ this.$element.unwrap()
138
+ }
139
+
140
+ // TOGGLE PLUGIN DEFINITION
141
+ // ========================
142
+
143
+ function Plugin(option) {
144
+ return this.each(function () {
145
+ var $this = $(this)
146
+ var data = $this.data('bs.toggle')
147
+ var options = typeof option == 'object' && option
148
+
149
+ if (!data) $this.data('bs.toggle', (data = new Toggle(this, options)))
150
+ if (typeof option == 'string' && data[option]) data[option]()
151
+ })
152
+ }
153
+
154
+ var old = $.fn.bootstrapToggle
155
+
156
+ $.fn.bootstrapToggle = Plugin
157
+ $.fn.bootstrapToggle.Constructor = Toggle
158
+
159
+ // TOGGLE NO CONFLICT
160
+ // ==================
161
+
162
+ $.fn.toggle.noConflict = function () {
163
+ $.fn.bootstrapToggle = old
164
+ return this
165
+ }
166
+
167
+ // TOGGLE DATA-API
168
+ // ===============
169
+
170
+ $(function() {
171
+ $('input[type=checkbox][data-toggle^=toggle]').bootstrapToggle()
172
+ })
173
+
174
+ $(document).on('click.bs.toggle', 'div[data-toggle^=toggle]', function(e) {
175
+ var $checkbox = $(this).find('input[type=checkbox]')
176
+ $checkbox.bootstrapToggle('toggle')
177
+ e.preventDefault()
178
+ })
179
+
180
+ }(jQuery);
@@ -0,0 +1,83 @@
1
+ /*! ========================================================================
2
+ * Bootstrap Toggle: bootstrap-toggle.css v2.2.0
3
+ * http://www.bootstraptoggle.com
4
+ * ========================================================================
5
+ * Copyright 2014 Min Hur, The New York Times Company
6
+ * Licensed under MIT
7
+ * ======================================================================== */
8
+
9
+
10
+ .checkbox label .toggle,
11
+ .checkbox-inline .toggle {
12
+ margin-left: -20px;
13
+ margin-right: 5px;
14
+ }
15
+
16
+ .toggle {
17
+ position: relative;
18
+ overflow: hidden;
19
+ }
20
+ .toggle input[type="checkbox"] {
21
+ display: none;
22
+ }
23
+ .toggle-group {
24
+ position: absolute;
25
+ width: 200%;
26
+ top: 0;
27
+ bottom: 0;
28
+ left: 0;
29
+ transition: left 0.35s;
30
+ -webkit-transition: left 0.35s;
31
+ -moz-user-select: none;
32
+ -webkit-user-select: none;
33
+ }
34
+ .toggle.off .toggle-group {
35
+ left: -100%;
36
+ }
37
+ .toggle-on {
38
+ position: absolute;
39
+ top: 0;
40
+ bottom: 0;
41
+ left: 0;
42
+ right: 50%;
43
+ margin: 0;
44
+ border: 0;
45
+ border-radius: 0;
46
+ }
47
+ .toggle-off {
48
+ position: absolute;
49
+ top: 0;
50
+ bottom: 0;
51
+ left: 50%;
52
+ right: 0;
53
+ margin: 0;
54
+ border: 0;
55
+ border-radius: 0;
56
+ }
57
+ .toggle-handle {
58
+ position: relative;
59
+ margin: 0 auto;
60
+ padding-top: 0px;
61
+ padding-bottom: 0px;
62
+ height: 100%;
63
+ width: 0px;
64
+ border-width: 0 1px;
65
+ }
66
+
67
+ .toggle.btn { min-width: 59px; min-height: 34px; }
68
+ .toggle-on.btn { padding-right: 24px; }
69
+ .toggle-off.btn { padding-left: 24px; }
70
+
71
+ .toggle.btn-lg { min-width: 79px; min-height: 45px; }
72
+ .toggle-on.btn-lg { padding-right: 31px; }
73
+ .toggle-off.btn-lg { padding-left: 31px; }
74
+ .toggle-handle.btn-lg { width: 40px; }
75
+
76
+ .toggle.btn-sm { min-width: 50px; min-height: 30px;}
77
+ .toggle-on.btn-sm { padding-right: 20px; }
78
+ .toggle-off.btn-sm { padding-left: 20px; }
79
+
80
+ .toggle.btn-xs { min-width: 35px; min-height: 22px;}
81
+ .toggle-on.btn-xs { padding-right: 12px; }
82
+ .toggle-off.btn-xs { padding-left: 12px; }
83
+
@@ -0,0 +1,85 @@
1
+ /*! ========================================================================
2
+ * Bootstrap Toggle: bootstrap2-toggle.css v2.2.0
3
+ * http://www.bootstraptoggle.com
4
+ * ========================================================================
5
+ * Copyright 2014 Min Hur, The New York Times Company
6
+ * Licensed under MIT
7
+ * ======================================================================== */
8
+
9
+
10
+ label.checkbox .toggle,
11
+ label.checkbox.inline .toggle {
12
+ margin-left: -20px;
13
+ margin-right: 5px;
14
+ }
15
+ .toggle {
16
+ min-width: 40px;
17
+ height: 20px;
18
+ position: relative;
19
+ overflow: hidden;
20
+ }
21
+ .toggle input[type="checkbox"] {
22
+ display: none;
23
+ }
24
+ .toggle-group {
25
+ position: absolute;
26
+ width: 200%;
27
+ top: 0;
28
+ bottom: 0;
29
+ left: 0;
30
+ transition: left 0.35s;
31
+ -webkit-transition: left 0.35s;
32
+ -moz-user-select: none;
33
+ -webkit-user-select: none;
34
+ }
35
+ .toggle.off .toggle-group {
36
+ left: -100%;
37
+ }
38
+ .toggle-on {
39
+ position: absolute;
40
+ top: 0;
41
+ bottom: 0;
42
+ left: 0;
43
+ right: 50%;
44
+ margin: 0;
45
+ border: 0;
46
+ border-radius: 0;
47
+ }
48
+ .toggle-off {
49
+ position: absolute;
50
+ top: 0;
51
+ bottom: 0;
52
+ left: 50%;
53
+ right: 0;
54
+ margin: 0;
55
+ border: 0;
56
+ border-radius: 0;
57
+ }
58
+ .toggle-handle {
59
+ position: relative;
60
+ margin: 0 auto;
61
+ padding-top: 0px;
62
+ padding-bottom: 0px;
63
+ height: 100%;
64
+ width: 0px;
65
+ border-width: 0 1px;
66
+ }
67
+ .toggle-handle.btn-mini {
68
+ top: -1px;
69
+ }
70
+ .toggle.btn { min-width: 30px; }
71
+ .toggle-on.btn { padding-right: 24px; }
72
+ .toggle-off.btn { padding-left: 24px; }
73
+
74
+ .toggle.btn-large { min-width: 40px; }
75
+ .toggle-on.btn-large { padding-right: 35px; }
76
+ .toggle-off.btn-large { padding-left: 35px; }
77
+
78
+ .toggle.btn-small { min-width: 25px; }
79
+ .toggle-on.btn-small { padding-right: 20px; }
80
+ .toggle-off.btn-small { padding-left: 20px; }
81
+
82
+ .toggle.btn-mini { min-width: 20px; }
83
+ .toggle-on.btn-mini { padding-right: 12px; }
84
+ .toggle-off.btn-mini { padding-left: 12px; }
85
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bootstrap/toggle/rails"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bootstrap/toggle/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bootstrap-toggle-rails"
8
+ spec.version = Bootstrap::Toggle::Rails::VERSION
9
+ spec.authors = ["Raphael Kallensee"]
10
+ spec.email = ["raphael@kallensee.name"]
11
+
12
+ spec.summary = %q{Bootstrap Toggle (unofficial) plugin for the Rails asset pipeline}
13
+ spec.description = %q{Bootstrap Toggle is a highly flexible Bootstrap plugin that converts checkboxes into toggles.}
14
+ spec.homepage = "https://github.com/rkallensee/bootstrap-toggle-rails"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
@@ -0,0 +1,10 @@
1
+ require "bootstrap/toggle/rails/engine"
2
+ require "bootstrap/toggle/rails/version"
3
+
4
+ module Bootstrap
5
+ module Toggle
6
+ module Rails
7
+ # Your code goes here...
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ module Bootstrap
2
+ module Toggle
3
+ module Rails
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Bootstrap
2
+ module Toggle
3
+ module Rails
4
+ VERSION = "2.2.1.0"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bootstrap-toggle-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Raphael Kallensee
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Bootstrap Toggle is a highly flexible Bootstrap plugin that converts
42
+ checkboxes into toggles.
43
+ email:
44
+ - raphael@kallensee.name
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - CODE_OF_CONDUCT.md
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - app/assets/javascripts/bootstrap-toggle.js
56
+ - app/assets/javascripts/bootstrap2-toggle.js
57
+ - app/assets/stylesheets/bootstrap-toggle.css
58
+ - app/assets/stylesheets/bootstrap2-toggle.css
59
+ - bin/console
60
+ - bin/setup
61
+ - bootstrap-toggle-rails.gemspec
62
+ - lib/bootstrap/toggle/rails.rb
63
+ - lib/bootstrap/toggle/rails/engine.rb
64
+ - lib/bootstrap/toggle/rails/version.rb
65
+ homepage: https://github.com/rkallensee/bootstrap-toggle-rails
66
+ licenses:
67
+ - MIT
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.4.5
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Bootstrap Toggle (unofficial) plugin for the Rails asset pipeline
89
+ test_files: []