bootstrap-bookingsync-sass 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +132 -0
- data/assets/fonts/bookingsync/bookingsync-smiles.eot +0 -0
- data/assets/fonts/bookingsync/bookingsync-smiles.svg +19 -0
- data/assets/fonts/bookingsync/bookingsync-smiles.ttf +0 -0
- data/assets/fonts/bookingsync/bookingsync-smiles.woff +0 -0
- data/assets/javascripts/bookingsync/form.js +40 -0
- data/assets/javascripts/bookingsync/switch.js +388 -0
- data/assets/javascripts/bootstrap-bookingsync-sprockets.js +2 -0
- data/assets/stylesheets/_bootstrap-bookingsync-sprockets.scss +16 -0
- data/assets/stylesheets/_bootstrap-bookingsync.scss +63 -0
- data/assets/stylesheets/bookingsync/_chosen.scss +83 -0
- data/assets/stylesheets/bookingsync/_form.scss +265 -0
- data/assets/stylesheets/bookingsync/_layout.scss +99 -0
- data/assets/stylesheets/bookingsync/_smiles.scss +58 -0
- data/assets/stylesheets/bookingsync/_switch.scss +222 -0
- data/assets/stylesheets/bookingsync/_theme.scss +374 -0
- data/assets/stylesheets/bookingsync/_variables.scss +183 -0
- data/bootstrap-bookingsync-sass.gemspec +17 -0
- data/lib/bootstrap-bookingsync-sass.rb +86 -0
- data/lib/bootstrap/bookingsync/engine.rb +16 -0
- data/lib/bootstrap/bookingsync/version.rb +5 -0
- metadata +27 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 490e5a2374260a96c17d68005af163a284118995
|
4
|
+
data.tar.gz: efe6eccf077df2f4d392de962d9d31551db12ed0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c7b4706cb592ce0004decd962c1daaefa900ed57033d608e3b0570910c1164da1d89051769c56dc9cc22a711b8b35cb25370a28d9fb528cc0381c4386938298
|
7
|
+
data.tar.gz: 93d63948b83f989e796101b742b1b3d6f118000cd4e3219963c55e90e351b3cbe8b1046b9ee7fe8fede2ab0dfb03a31b7effc8b3d9e7e599afb403da2ba09df5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 BookingSync SAS
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Bootstrap BookingSync SASS
|
2
|
+
|
3
|
+
`bootstrap-bookingsync-sass` is a Sass-powered version of [Bootstrap](http://github.com/twbs/bootstrap) with [BookingSync theme](http://styleguide.bookingsync.com), ready to drop right into your Sass powered applications.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
`bootstrap-bookingsync-sass` is easy to drop into Rails with the asset pipeline.
|
8
|
+
|
9
|
+
In your Gemfile you need to add the `bootstrap-bookingsync-sass` gem.
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'bootstrap-bookingsync-sass'
|
13
|
+
```
|
14
|
+
|
15
|
+
`bundle install` and restart your server to make the files available through the pipeline.
|
16
|
+
|
17
|
+
Import Bootstrap styles in `app/assets/stylesheets/application.scss`:
|
18
|
+
|
19
|
+
```scss
|
20
|
+
// "bootstrap-bookingsync-sprockets" must be imported before "bootstrap-bookingsync" and "bootstrap-bookingsync/variables"
|
21
|
+
@import "bootstrap-bookingsync-sprockets";
|
22
|
+
@import "bootstrap-bookingsync";
|
23
|
+
```
|
24
|
+
|
25
|
+
`bootstrap-bookingsync-sprockets` must be imported before `bootstrap-bookingsync` for the icon fonts to work.
|
26
|
+
|
27
|
+
Make sure the file has `.scss` extension (or `.sass` for Sass syntax). If you have just generated a new Rails app,
|
28
|
+
it may come with a `.css` file instead. If this file exists, it will be served instead of Sass, so rename it:
|
29
|
+
|
30
|
+
```console
|
31
|
+
$ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
|
32
|
+
```
|
33
|
+
|
34
|
+
Then, remove all the `*= require_self` and `*= require_tree .` statements from the sass file. Instead, use `@import` to import Sass files.
|
35
|
+
|
36
|
+
Do not use `*= require` in Sass or your other stylesheets will not be [able to access][antirequire] the Bootstrap BookingSync mixins or variables.
|
37
|
+
|
38
|
+
Require Bootstrap BookingSync Javascripts in `app/assets/javascripts/application.js`:
|
39
|
+
|
40
|
+
```js
|
41
|
+
//= require jquery
|
42
|
+
//= require bootstrap-bookingsync-sprockets
|
43
|
+
```
|
44
|
+
|
45
|
+
`bootstrap-bookingsync-sprockets` provides individual Bootstrap BookingSync Javascript files (`form.js` or `switch.js`, for example).
|
46
|
+
|
47
|
+
`bootstrap-bookingsync-sprockets` won't load any Boostrap javascripts, you have to load them manually if you need them.
|
48
|
+
|
49
|
+
|
50
|
+
## Using SimpleForm?
|
51
|
+
|
52
|
+
The following initializer will make your inputs formatted to work best to Boostrap BookingSync Forms.
|
53
|
+
Note that you need [SimpleForm](https://github.com/plataformatec/simple_form) 3.1+.
|
54
|
+
|
55
|
+
To use it, create a `config/initializers/simple_form_bootstrap_bookingsync.rb` file with the following content:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
#
|
59
|
+
# Copyright 2015 BookingSync SAS.
|
60
|
+
# Licensed under MIT (https://github.com/BookingSync/bootstrap-bookingsync-sass/blob/master/LICENSE)
|
61
|
+
#
|
62
|
+
|
63
|
+
# Use this setup block to configure all options available in SimpleForm.
|
64
|
+
SimpleForm.setup do |config|
|
65
|
+
config.wrappers :bs, tag: 'div', error_class: 'has-error' do |b|
|
66
|
+
b.wrapper tag: 'div', class: 'form-group' do |ba|
|
67
|
+
ba.use :html5
|
68
|
+
ba.use :label
|
69
|
+
ba.use :input, class: 'form-control'
|
70
|
+
end
|
71
|
+
b.use :error, wrap_with: { tag: 'span', class: 'error-message' }
|
72
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
73
|
+
end
|
74
|
+
|
75
|
+
config.wrappers :bs_addon, tag: 'div', class: "form-group", error_class: 'error' do |b|
|
76
|
+
b.use :html5
|
77
|
+
b.wrapper tag: 'div', class: 'input-group' do |addon|
|
78
|
+
addon.use :prepend_addon
|
79
|
+
addon.use :label
|
80
|
+
addon.use :input, class: 'form-control'
|
81
|
+
addon.use :append_addon
|
82
|
+
end
|
83
|
+
b.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
84
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
85
|
+
end
|
86
|
+
|
87
|
+
config.wrappers :bs_checkbox, tag: 'div', error_class: 'has-error' do |b|
|
88
|
+
b.wrapper tag: 'div', class: 'checkbox' do |ba|
|
89
|
+
ba.use :html5
|
90
|
+
ba.use :label_input
|
91
|
+
end
|
92
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
93
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
94
|
+
end
|
95
|
+
|
96
|
+
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
97
|
+
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
98
|
+
# to learn about the different styles for forms and inputs,
|
99
|
+
# buttons and other elements.
|
100
|
+
config.default_wrapper = :bs
|
101
|
+
end
|
102
|
+
|
103
|
+
module SimpleForm
|
104
|
+
module Components
|
105
|
+
module Addons
|
106
|
+
def prepend_addon(wrapper_options = nil)
|
107
|
+
return input_group_addon(options[:prepend_addon]) unless options[:prepend_addon].nil?
|
108
|
+
end
|
109
|
+
|
110
|
+
def append_addon(wrapper_options = nil)
|
111
|
+
return input_group_addon(options[:append_addon]) unless options[:append_addon].nil?
|
112
|
+
end
|
113
|
+
|
114
|
+
def input_group_addon(content)
|
115
|
+
template.content_tag(:span, content, class: 'input-group-addon')
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
SimpleForm::Inputs::Base.send(:include, SimpleForm::Components::Addons)
|
122
|
+
```
|
123
|
+
|
124
|
+
### Usage
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
<%= f.input :title %>
|
128
|
+
<%= f.input :accept_terms, wrapper: :bs_checkbox %>
|
129
|
+
<%= f.input :twitter, wrapper: :bs_addon, prepend_addon: '@' %>
|
130
|
+
<%= f.input :pecentage, wrapper: :bs_addon, append_addon: '%' %>
|
131
|
+
<%= f.input :money, wrapper: :bs_addon, prepend_addon: '$', append_addon: 'USD' %>
|
132
|
+
```
|
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4
|
+
<metadata>Generated by IcoMoon</metadata>
|
5
|
+
<defs>
|
6
|
+
<font id="bookingsync-smiles" horiz-adv-x="1024">
|
7
|
+
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
8
|
+
<missing-glyph horiz-adv-x="1024" />
|
9
|
+
<glyph unicode=" " horiz-adv-x="512" d="" />
|
10
|
+
<glyph unicode="" glyph-name="bigboss" d="M802.488 286.945c-0.051 1.372-0.113 2.816-0.174 4.321-0.031 1.505-0.164 3.082-0.338 4.721-0.184 1.638-0.287 3.338-0.563 5.089-0.287 1.751-0.573 3.553-0.87 5.396-0.41 1.843-0.829 3.727-1.249 5.642-0.471 1.915-1.075 3.85-1.638 5.816-0.614 1.956-1.372 3.922-2.079 5.908-0.799 1.966-1.659 3.942-2.56 5.908-1.004 1.925-1.915 3.922-3.041 5.806-1.106 1.894-2.212 3.809-3.482 5.612-1.198 1.853-2.529 3.604-3.871 5.335-2.703 3.441-5.612 6.656-8.653 9.523-6.042 5.806-12.493 10.271-18.278 13.609-5.827 3.297-10.998 5.499-14.879 6.861-1.925 0.696-3.543 1.178-4.762 1.516-0.307 0.082-0.584 0.154-0.819 0.225-0.338 0.082-0.625 0.143-0.85 0.205-0.328 0.082-0.492 0.113-0.492 0.113l-0.256 0.061c-0.768 0.174-1.546 0.317-2.345 0.41-11.622 1.372-22.149-6.943-23.511-18.565-1.372-11.622 6.943-22.149 18.565-23.511 0 0 0.031 0 0.082-0.010 0.020 0 0.051-0.010 0.092-0.010l-0.031 0.010c-0.020 0.010-0.072 0.031-0.072 0.041 0.072-0.010 0.154-0.010 0.246-0.020 0.399-0.041 1.137-0.133 2.171-0.348 2.048-0.389 5.212-1.229 8.878-2.662 2.243-0.911 4.68-2.079 7.148-3.482-65.27-76.708-160.051-120.32-263.066-120.32-109.711 0-195.451 42.936-199.895 42.936-2.12 0-4.27-0.44-6.267-1.372-6.216-2.888-10.588-10.097-7.188-15.739 30.986-51.425 150.548-98.15 216.504-98.15 66.079 0 128.369 16.783 180.132 48.548 46.172 28.334 81.644 67.625 104.038 114.862 0.297-0.799 0.594-1.608 0.881-2.386 0.379-1.27 0.758-2.519 1.126-3.738 0.379-1.219 0.604-2.468 0.901-3.635 0.297-1.178 0.553-2.335 0.727-3.471 0.205-1.137 0.389-2.222 0.573-3.256 0.174-1.034 0.246-2.048 0.369-2.99 0.236-1.884 0.44-3.533 0.481-4.925 0.174-2.775 0.276-4.352 0.276-4.352l0.051-0.891c0.42-6.748 5.796-12.319 12.728-12.8 7.557-0.532 14.111 5.161 14.643 12.718 0 0 0.133 1.946 0.379 5.366 0.154 1.7 0.195 3.799 0.215 6.216 0 1.208 0.061 2.488 0.020 3.86zM249.385 728.207c-55.921 0-111.534 0-166.625 0v-66.232c18.688-9.339 24.197-31.877 30.464-67.574l135.854 133.54c0.102 0.092 0.205 0.174 0.307 0.266zM122.481 542.884c0.010-0.051 0.020-0.092 0.031-0.143 26.491-66.232 49.183-78.070 132.475-92.733s157.921 30.024 184.207 70.738l-180.869 88.893-135.844-66.755zM761.928 728.207c0.102-0.092 0.205-0.174 0.307-0.276l135.854-133.54c6.267 35.697 11.776 58.235 30.464 67.574v66.243c-55.091 0-110.705 0-166.625 0zM267.254 728.207c0.102-0.092 185.59-182.405 185.59-182.405 18.268 39.168 24.207 63.836 52.808 64.696 28.6-0.86 34.55-25.528 52.808-64.696 0 0 185.487 182.313 185.59 182.405zM572.129 520.755c26.286-40.724 100.915-85.402 184.207-70.738s105.974 26.491 132.475 92.733c0.010 0.051 0.020 0.092 0.031 0.143l-135.844 66.765-180.869-88.904z" />
|
11
|
+
<glyph unicode="" glyph-name="boss" d="M32.072 513.454c-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.54-3.584-6.595-5.56-10.752-5.56-1.966 0-3.953 0.44-5.806 1.352l-185.836 91.341-185.846-91.341c-1.864-0.911-3.85-1.352-5.816-1.352zM990.331 513.454c-1.966 0-3.942 0.44-5.806 1.352l-185.846 91.341-185.846-91.341c-1.864-0.911-3.84-1.352-5.806-1.352-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.529-3.594-6.584-5.56-10.752-5.56zM812.339 286.945c-0.051 1.372-0.113 2.816-0.174 4.321-0.031 1.505-0.164 3.082-0.338 4.721-0.184 1.638-0.287 3.338-0.563 5.089-0.287 1.751-0.573 3.553-0.87 5.396-0.41 1.843-0.829 3.727-1.249 5.642-0.471 1.915-1.075 3.85-1.649 5.816-0.614 1.956-1.372 3.922-2.079 5.908-0.799 1.966-1.659 3.942-2.55 5.908-1.004 1.925-1.915 3.922-3.041 5.806-1.106 1.894-2.212 3.809-3.482 5.612-1.198 1.853-2.529 3.604-3.871 5.335-2.703 3.441-5.612 6.656-8.653 9.523-6.042 5.806-12.493 10.271-18.278 13.609-5.827 3.297-10.998 5.499-14.879 6.861-1.925 0.696-3.543 1.178-4.762 1.516-0.307 0.082-0.584 0.154-0.819 0.225-0.338 0.082-0.625 0.143-0.85 0.205-0.328 0.082-0.492 0.113-0.492 0.113l-0.256 0.061c-0.768 0.174-1.546 0.317-2.345 0.41-11.622 1.362-22.149-6.943-23.511-18.565s6.943-22.149 18.565-23.511c0 0 0.031 0 0.082-0.010 0.020 0 0.051-0.010 0.092-0.010l-0.031 0.010c-0.020 0.010-0.072 0.031-0.072 0.041 0.072-0.010 0.154-0.010 0.246-0.020 0.399-0.041 1.137-0.133 2.171-0.348 2.048-0.389 5.212-1.229 8.878-2.662 2.243-0.911 4.68-2.079 7.148-3.482-65.27-76.708-160.051-120.32-263.066-120.32-109.711 0-195.451 42.936-199.895 42.936-2.12 0-4.27-0.44-6.267-1.372-6.216-2.888-10.588-10.097-7.188-15.739 30.986-51.425 150.548-98.15 216.504-98.15 66.079 0 128.369 16.783 180.132 48.548 46.172 28.334 81.644 67.625 104.038 114.862 0.297-0.799 0.594-1.608 0.881-2.386 0.379-1.28 0.758-2.519 1.126-3.738 0.379-1.219 0.604-2.468 0.901-3.635 0.297-1.178 0.553-2.335 0.727-3.471 0.205-1.137 0.389-2.222 0.573-3.256 0.174-1.034 0.246-2.048 0.369-2.99 0.236-1.884 0.44-3.533 0.481-4.925 0.174-2.775 0.276-4.352 0.276-4.352l0.051-0.891c0.42-6.748 5.796-12.319 12.728-12.8 7.557-0.532 14.111 5.161 14.643 12.718 0 0 0.133 1.946 0.379 5.366 0.154 1.7 0.195 3.799 0.215 6.216 0 1.208 0.061 2.488 0.020 3.86z" />
|
12
|
+
<glyph unicode="" glyph-name="bookingsync" d="M514.458 137.83c-61.604 0-122.665 17.531-171.95 49.367-54.241 35.031-93.030 85.903-112.189 147.108-1.935 6.185 0.911 12.861 6.717 15.739 1.874 0.932 3.881 1.372 5.857 1.372 4.147 0 8.202-1.956 10.742-5.53 61.43-86.262 155.433-135.731 257.905-135.731 102.461 0 196.229 49.459 257.239 135.7 2.54 3.594 6.605 5.571 10.762 5.571 1.946 0 3.922-0.43 5.775-1.331 5.806-2.836 8.704-9.462 6.84-15.647-18.729-62.126-56.576-113.326-109.445-148.060-48.364-31.775-106.537-48.558-168.253-48.558zM32.072 513.454c-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.54-3.584-6.595-5.56-10.752-5.56-1.966 0-3.953 0.44-5.806 1.352l-185.836 91.341-185.846-91.341c-1.864-0.911-3.85-1.352-5.816-1.352zM990.331 513.454c-1.966 0-3.942 0.44-5.806 1.352l-185.846 91.341-185.846-91.341c-1.864-0.911-3.84-1.352-5.806-1.352-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.529-3.594-6.584-5.56-10.752-5.56z" />
|
13
|
+
<glyph unicode="" glyph-name="laughting" d="M32.072 550.39c-4.157 0-8.212 1.966-10.762 5.56-3.738 5.274-3.103 12.483 1.516 17.019l191.662 188.385c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.54-3.584-6.595-5.56-10.762-5.56-1.966 0-3.953 0.44-5.806 1.352l-185.836 91.341-185.836-91.331c-1.864-0.911-3.85-1.352-5.816-1.352zM990.331 550.39c-1.966 0-3.942 0.44-5.806 1.352l-185.836 91.341-185.836-91.341c-1.864-0.911-3.84-1.352-5.806-1.352-4.157 0-8.212 1.966-10.762 5.56-3.738 5.274-3.103 12.483 1.516 17.019l191.652 188.385c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.54-3.584-6.595-5.55-10.762-5.55zM830.843 354.621c-2.161 1.055-4.475 1.556-6.748 1.556h-627.169c-2.314 0-4.659-0.522-6.84-1.608-6.779-3.369-10.107-11.172-7.844-18.391 22.395-71.526 67.727-144.65 131.113-185.59 57.6-37.202 128.963-57.692 200.96-57.692 72.131 0 140.114 19.62 196.618 56.74 61.788 40.591 106.025 114.094 127.908 186.696 2.161 7.229-1.219 14.971-7.997 18.289zM510.884 177.418c-108.032 0-208.005 58.184-279.255 143.585h557.896c-70.851-85.402-170.598-143.585-278.641-143.585z" />
|
14
|
+
<glyph unicode="" glyph-name="lemonface" d="M32.072 503.624c-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.54-3.584-6.595-5.56-10.752-5.56-1.966 0-3.953 0.44-5.806 1.352l-185.836 91.341-185.846-91.341c-1.864-0.922-3.85-1.352-5.816-1.352zM990.331 503.624c-1.966 0-3.942 0.44-5.806 1.352l-185.846 91.341-185.846-91.341c-1.864-0.911-3.84-1.352-5.806-1.352-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.529-3.594-6.584-5.56-10.752-5.56zM395.090 147.558c-5.448 0-10.353 0.696-14.531 1.659-42.22 9.759-68.833 57.569-97.004 108.186-9.155 16.445-17.828 32.031-26.358 44.882-5.458-4.567-15.35-14.981-29.215-38.011-13.066-21.699-22.2-42.435-22.292-42.639-7.27-16.568-26.604-24.125-43.172-16.855-16.568 7.26-24.125 26.573-16.876 43.141 0.481 1.106 12.022 27.351 28.754 54.374 27.269 44.042 52.746 65.761 80.2 68.362 12.349 1.157 35.881-0.942 54.63-28.273 10.916-15.913 21.443-34.816 31.611-53.105 11.305-20.316 22.999-41.318 34.406-56.658 11.96-16.077 18.483-19.005 19.835-19.466 0.41 0.154 1.321 0.553 2.755 1.556 14.889 10.373 29.061 25.59 42.762 40.305 16.62 17.848 32.317 34.703 50.77 45.076 27.044 15.206 55.398 13.005 79.841-6.205 12.155-9.554 23.112-20.173 33.7-30.433 40.448-39.209 46.305-38.031 58.726-28.416 13.998 10.834 24.115 24.535 33.905 37.786 11.756 15.913 22.866 30.945 39.854 39.916 21.914 11.571 46.305 9.257 72.499-6.871 15.411-9.492 20.214-29.676 10.721-45.097-9.492-15.411-29.676-20.214-45.097-10.721-4.413 2.714-7.137 3.738-8.458 4.127-4.004-2.98-11.336-12.902-16.804-20.296-11.274-15.258-25.303-34.253-46.5-50.657-27.218-21.074-57.242-25.098-86.804-11.622-21.627 9.861-39.956 27.628-57.672 44.8-9.39 9.103-19.098 18.514-28.57 25.958-1.853 1.454-3.082 2.048-3.553 2.212-7.649-0.993-27.75-22.579-38.584-34.212-15.299-16.425-32.635-35.041-53.248-49.418-14.746-10.271-28.713-13.384-40.233-13.384z" />
|
15
|
+
<glyph unicode="" glyph-name="sadface" d="M507.955 351.416c61.604 0 122.665-17.531 171.95-49.367 54.241-35.031 93.030-85.903 112.189-147.108 1.935-6.185-0.911-12.861-6.717-15.739-1.874-0.932-3.881-1.372-5.857-1.372-4.147 0-8.202 1.956-10.742 5.53-61.43 86.262-155.433 135.731-257.905 135.731-102.461 0-196.229-49.459-257.239-135.7-2.54-3.594-6.605-5.571-10.762-5.571-1.946 0-3.922 0.43-5.775 1.331-5.806 2.836-8.704 9.462-6.84 15.647 18.729 62.126 56.576 113.326 109.445 148.060 48.353 31.775 106.527 48.558 168.253 48.558zM32.072 513.454c-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.54-3.584-6.595-5.56-10.752-5.56-1.966 0-3.953 0.44-5.806 1.352l-185.836 91.341-185.846-91.341c-1.864-0.911-3.85-1.352-5.816-1.352zM990.331 513.454c-1.966 0-3.942 0.44-5.806 1.352l-185.846 91.341-185.846-91.341c-1.864-0.911-3.84-1.352-5.806-1.352-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.529-3.594-6.584-5.56-10.752-5.56z" />
|
16
|
+
<glyph unicode="" glyph-name="tongue" d="M514.458 183.716c-61.604 0-122.665 17.531-171.95 49.367-54.241 35.031-93.030 85.903-112.189 147.108-1.935 6.185 0.911 12.861 6.717 15.739 1.874 0.932 3.881 1.372 5.857 1.372 4.147 0 8.202-1.956 10.742-5.53 61.43-86.262 155.433-135.731 257.905-135.731 102.461 0 196.229 49.459 257.239 135.7 2.54 3.594 6.605 5.571 10.762 5.571 1.946 0 3.922-0.43 5.775-1.331 5.806-2.836 8.704-9.462 6.84-15.647-18.729-62.126-56.576-113.326-109.445-148.060-48.364-31.775-106.537-48.558-168.253-48.558zM32.072 559.34c-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.54-3.584-6.595-5.56-10.752-5.56-1.966 0-3.953 0.44-5.806 1.352l-185.836 91.341-185.846-91.341c-1.864-0.911-3.85-1.352-5.816-1.352zM990.331 559.34c-1.966 0-3.942 0.44-5.806 1.352l-185.846 91.341-185.846-91.341c-1.864-0.911-3.84-1.352-5.806-1.352-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.662 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.54-3.594-6.595-5.56-10.762-5.56zM602.552 243.825c0.020-0.010 0.061 0 0.358-0.092 0.287-0.092 0.655-0.205 1.106-0.328 0.87-0.276 2.161-0.686 3.85-1.229 3.287-1.137 7.946-2.97 13.599-5.929 5.642-2.97 12.298-7.045 19.405-12.892 7.076-5.868 14.776-13.455 21.504-24.351 3.318-5.458 6.41-11.807 8.55-19.21 0.256-0.932 0.522-1.864 0.788-2.796 0.215-0.973 0.43-1.946 0.645-2.929 0.266-1.249 0.532-2.509 0.809-3.768l0.102-0.492 0.051-0.236 0.031-0.051 0.102-0.215c0.061-0.143 0.102-0.297 0.123-0.451 0.276-0.635 0.44-1.311 0.748-1.976 2.202-5.325 6.932-11.254 13.527-15.872 3.277-2.304 6.963-4.291 10.854-5.714 3.871-1.475 7.916-2.406 11.868-2.765 3.953-0.338 7.803-0.072 11.366 0.799 1.792 0.42 3.512 1.014 5.181 1.71l0.246 0.092c0.195 0.092-1.413-0.727-0.666-0.348l2.714 1.382 0.512 0.266 0.143 0.113c0.195 0.143 0.399 0.266 0.614 0.369l0.164 0.082 0.266 0.195 0.543 0.379c5.827 3.932 10.844 10.895 13.568 19.118 2.796 8.223 3.318 17.48 1.843 26.184-1.413 8.755-4.946 16.998-9.779 24.095-1.157 1.802-2.509 3.471-3.82 5.14-0.707 0.799-1.372 1.618-2.048 2.427l-0.123 0.154-0.061 0.082c-0.072 0.082 0.451-0.44 0.184-0.174l-2.376 2.519c-0.901 0.952-1.792 1.905-2.673 2.836-0.87 0.922-1.792 1.935-2.56 2.652-1.587 1.577-3.154 3.133-4.68 4.649-6.472 6.134-12.749 11.418-18.422 15.79-5.693 4.383-10.926 7.68-15.217 10.23-4.301 2.54-7.741 4.188-9.953 5.181-2.232 1.014-3.154 1.311-2.683 1.208l6.083 28.682c0.471-0.092 2.724-0.492 6.236-1.444 3.533-0.973 8.407-2.57 14.295-5.007 5.908-2.417 12.739-5.827 20.183-10.23 7.475-4.372 15.462-9.83 23.757-16.343 2.099-1.72 4.239-3.471 6.42-5.263 1.157-0.932 2.028-1.731 3.021-2.591 0.973-0.85 1.946-1.7 2.939-2.57l2.232-1.956 0.379-0.328 0.686-0.666c1.157-1.126 2.314-2.273 3.492-3.42 2.253-2.396 4.536-4.864 6.646-7.567 8.571-10.66 15.739-23.951 19.456-38.984 1.884-7.506 2.826-15.411 2.826-23.48-0.031-8.069-0.973-16.323-3.256-24.453-2.263-8.12-5.581-16.189-10.394-23.706-4.762-7.526-10.926-14.531-18.473-20.224l-2.12-1.597-0.86-0.573c-1.147-0.758-2.314-1.505-3.492-2.232l-0.881-0.543-0.553-0.317-1.065-0.594-1.055-0.594-0.532-0.297-0.942-0.481-0.195-0.092-0.399-0.184c-4.188-2.038-8.54-3.738-12.995-4.987-8.899-2.499-18.043-3.348-26.808-2.877-8.776 0.512-17.234 2.212-25.108 5.018-7.905 2.755-15.268 6.513-22.026 11.069-13.476 9.062-24.658 21.647-31.181 36.864-0.84 1.874-1.495 3.85-2.212 5.775-0.358 1.157-0.707 2.324-1.034 3.492l-0.471 1.741-0.113 0.44-0.061 0.256-0.113 0.492-0.43 1.976-0.102 0.481-0.195 0.973-0.020 0.061-0.031 0.123-0.113 0.481-0.205 0.963-0.307 0.993c-0.809 2.662-2.028 5.56-3.584 8.499-3.133 5.888-7.25 11.868-11.264 17.203-4.024 5.356-7.946 10.158-11.233 14.172-3.287 4.024-5.96 7.27-7.721 9.513-0.86 1.116-1.526 1.976-1.966 2.55-0.215 0.297-0.348 0.502-0.399 0.614s-0.174 0.225-0.154 0.215l15.104 25.119z" />
|
17
|
+
<glyph unicode="" glyph-name="winkface" d="M397.271 137.83c-65.956 0-185.518 46.725-216.504 98.15-3.4 5.642 0.973 12.861 7.188 15.739 2.007 0.932 4.147 1.372 6.267 1.372 4.444 0 90.184-42.936 199.895-42.936s210.094 49.459 275.425 135.7c2.724 3.594 7.066 5.571 11.53 5.571 2.089 0 4.198-0.43 6.185-1.331 6.216-2.836 9.318-9.462 7.322-15.647-20.050-62.126-60.58-113.326-117.187-148.060-51.753-31.775-114.033-48.558-180.122-48.558zM892.826 513.454c-1.966 0-3.942 0.44-5.806 1.352l-185.846 91.341-185.846-91.341c-1.864-0.911-3.84-1.352-5.806-1.352-4.157 0-8.212 1.966-10.752 5.56-3.748 5.274-3.103 12.483 1.516 17.019l191.652 188.396c2.56 2.519 5.898 3.779 9.236 3.779s6.676-1.26 9.236-3.779l191.652-188.396c4.618-4.536 5.253-11.745 1.516-17.019-2.54-3.594-6.595-5.56-10.752-5.56zM252.58 616.827c0-38.236-21.438-69.233-47.882-69.233s-47.882 30.997-47.882 69.233c0 38.236 21.438 69.233 47.882 69.233s47.882-30.997 47.882-69.233z" />
|
18
|
+
<glyph unicode="" glyph-name="winktongue" d="M393.738 184.259c-66.089 0-185.887 46.817-216.934 98.345-3.41 5.663 0.973 12.882 7.209 15.77 2.007 0.932 4.157 1.382 6.287 1.382 4.454 0 90.368-43.028 200.294-43.028s210.514 49.562 275.978 135.967c2.724 3.594 7.086 5.581 11.551 5.581 2.089 0 4.209-0.43 6.195-1.341 6.236-2.836 9.339-9.482 7.332-15.677-20.091-62.249-60.692-113.551-117.422-148.357-51.866-31.826-114.278-48.64-180.49-48.64zM890.276 560.63c-1.966 0-3.953 0.44-5.816 1.352l-186.214 91.525-186.214-91.525c-1.864-0.911-3.85-1.352-5.816-1.352-4.168 0-8.233 1.976-10.783 5.571-3.748 5.284-3.113 12.513 1.516 17.060l192.041 188.764c2.57 2.529 5.908 3.789 9.257 3.789s6.687-1.26 9.257-3.789l192.041-188.764c4.618-4.547 5.263-11.766 1.516-17.060-2.55-3.594-6.605-5.571-10.783-5.571zM248.771 664.218c0-38.31-21.483-69.366-47.985-69.366s-47.985 31.056-47.985 69.366c0 38.31 21.483 69.366 47.985 69.366s47.985-31.056 47.985-69.366zM504.033 240.896c0.020-0.010 0.061 0 0.358-0.092 0.287-0.092 0.655-0.205 1.096-0.328 0.86-0.276 2.15-0.686 3.82-1.219 3.267-1.126 7.885-2.949 13.496-5.888 5.601-2.939 12.196-6.984 19.261-12.79 7.025-5.827 14.664-13.353 21.34-24.166 3.297-5.417 6.359-11.715 8.489-19.067 0.256-0.922 0.522-1.843 0.778-2.775 0.215-0.963 0.43-1.935 0.635-2.908 0.266-1.239 0.532-2.488 0.799-3.748l0.102-0.492 0.051-0.236 0.031-0.051 0.092-0.215c0.061-0.143 0.102-0.287 0.123-0.451 0.276-0.625 0.44-1.3 0.748-1.956 2.181-5.284 6.881-11.172 13.425-15.749 3.246-2.284 6.912-4.26 10.772-5.663 3.84-1.464 7.854-2.396 11.786-2.744 3.922-0.338 7.741-0.072 11.284 0.788 1.772 0.42 3.482 1.004 5.14 1.7l0.246 0.092c0.184 0.092-1.403-0.727-0.666-0.348l0.532 0.276 2.15 1.085 0.512 0.266 0.143 0.113c0.195 0.143 0.389 0.266 0.614 0.369l0.164 0.082 0.266 0.195 0.543 0.379c5.786 3.901 10.762 10.813 13.466 18.975 2.775 8.161 3.297 17.347 1.833 25.989-1.403 8.694-4.915 16.876-9.708 23.91-1.147 1.792-2.499 3.441-3.799 5.1-0.696 0.788-1.362 1.608-2.028 2.417l-0.123 0.154-0.061 0.072c-0.072 0.082 0.451-0.43 0.184-0.174l-2.355 2.499c-0.891 0.952-1.782 1.884-2.652 2.816-0.87 0.911-1.782 1.915-2.54 2.632-1.577 1.567-3.123 3.103-4.639 4.608-6.42 6.093-12.657 11.336-18.289 15.667-5.642 4.352-10.844 7.619-15.094 10.148-4.27 2.519-7.68 4.157-9.882 5.14-2.222 1.004-3.133 1.3-2.662 1.198l6.042 28.457c0.461-0.092 2.703-0.481 6.195-1.434 3.512-0.963 8.346-2.55 14.193-4.977 5.857-2.396 12.646-5.786 20.029-10.148 7.414-4.342 15.34-9.748 23.572-16.22 2.079-1.71 4.209-3.441 6.369-5.222 1.147-0.922 2.017-1.72 3-2.57 0.963-0.84 1.935-1.69 2.918-2.55l1.475-1.29 0.748-0.645 0.369-0.328 0.686-0.666c1.147-1.126 2.304-2.253 3.461-3.389 2.232-2.386 4.506-4.823 6.595-7.516 8.509-10.578 15.616-23.767 19.313-38.687 1.874-7.444 2.806-15.299 2.806-23.306-0.031-8.008-0.963-16.2-3.226-24.269-2.253-8.059-5.54-16.067-10.312-23.532-4.721-7.465-10.844-14.418-18.33-20.070l-1.403-1.055-0.707-0.522-0.85-0.573c-1.137-0.758-2.294-1.495-3.461-2.212l-0.881-0.532-0.553-0.307-2.109-1.167-0.522-0.297-0.932-0.481-0.584-0.276c-4.157-2.017-8.479-3.707-12.892-4.946-8.827-2.478-17.91-3.328-26.604-2.847-8.704 0.512-17.101 2.191-24.924 4.977-7.844 2.734-15.155 6.461-21.852 10.988-13.373 8.991-24.474 21.484-30.945 36.588-0.829 1.864-1.485 3.82-2.191 5.734-0.358 1.147-0.696 2.304-1.024 3.461l-0.471 1.731-0.113 0.43-0.051 0.256-0.113 0.492-0.43 1.956-0.113 0.492-0.195 0.963-0.020 0.061-0.031 0.123-0.113 0.471-0.195 0.952-0.307 0.993c-0.799 2.642-2.007 5.519-3.564 8.438-3.103 5.847-7.188 11.786-11.182 17.070-3.994 5.315-7.885 10.086-11.151 14.070-3.267 3.994-5.908 7.219-7.66 9.431-0.85 1.106-1.516 1.956-1.956 2.529-0.215 0.297-0.348 0.502-0.399 0.604-0.051 0.113-0.174 0.225-0.154 0.215l14.961 24.945z" />
|
19
|
+
</font></defs></svg>
|
Binary file
|
Binary file
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* http://styleguide.bookingsync.com/javascript/#forms
|
3
|
+
* ========================================================================
|
4
|
+
* Copyright 2015 BookingSync SAS.
|
5
|
+
* Licensed under MIT (https://github.com/BookingSync/styleguide/blob/master/LICENSE)
|
6
|
+
* ======================================================================== */
|
7
|
+
|
8
|
+
+function ($) {
|
9
|
+
'use strict';
|
10
|
+
|
11
|
+
$('.form-group .form-control').each(function (index, e) {
|
12
|
+
if ($(e).val() !== '') {
|
13
|
+
$(e).parents('.form-group').addClass('filled');
|
14
|
+
}
|
15
|
+
});
|
16
|
+
$('.checkbox input[type="checkbox"][disabled]').each(function (index, e) {
|
17
|
+
$(e).parents('.checkbox').addClass('disabled');
|
18
|
+
});
|
19
|
+
$('.radio input[type="radio"][disabled]').each(function (index, e) {
|
20
|
+
$(e).parents('.radio').addClass('disabled');
|
21
|
+
});
|
22
|
+
$('.form-group .form-control[disabled]').each(function (index, e) {
|
23
|
+
$(e).parents('.form-group').addClass('disabled');
|
24
|
+
});
|
25
|
+
$('.form-group .form-control[readonly]').each(function (index, e) {
|
26
|
+
$(e).parents('.form-group').addClass('readonly');
|
27
|
+
});
|
28
|
+
$(document).on('focus', '.form-group .form-control', function (e) {
|
29
|
+
$(e.target).parents('.form-group').addClass('focused');
|
30
|
+
});
|
31
|
+
$(document).on('blur', '.form-group .form-control', function (e) {
|
32
|
+
$(e.target).parents('.form-group').removeClass('focused');
|
33
|
+
|
34
|
+
if ($(e.target).val() === '') {
|
35
|
+
$(e.target).parents('.form-group').removeClass('filled');
|
36
|
+
} else {
|
37
|
+
$(e.target).parents('.form-group').addClass('filled');
|
38
|
+
}
|
39
|
+
});
|
40
|
+
}(jQuery);
|
@@ -0,0 +1,388 @@
|
|
1
|
+
/*! ============================================================
|
2
|
+
* bootstrapSwitch v1.8 by Larentis Mattia @SpiritualGuru
|
3
|
+
* http://www.larentis.eu/
|
4
|
+
*
|
5
|
+
* Enhanced for radiobuttons by Stein, Peter @BdMdesigN
|
6
|
+
* http://www.bdmdesign.org/
|
7
|
+
*
|
8
|
+
* Tweaked for easier styling by Sebastien Grosjean, @SebGrosjean
|
9
|
+
* http://www.github.com/zencocoon
|
10
|
+
* 2015-08-31
|
11
|
+
*
|
12
|
+
* Project site:
|
13
|
+
* http://www.larentis.eu/switch/
|
14
|
+
* ============================================================
|
15
|
+
* Licensed under the Apache License, Version 2.0
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
* ============================================================ */
|
18
|
+
|
19
|
+
!function ($) {
|
20
|
+
"use strict";
|
21
|
+
|
22
|
+
$.fn['bootstrapSwitch'] = function (method) {
|
23
|
+
var inputSelector = 'input[type!="hidden"]';
|
24
|
+
var methods = {
|
25
|
+
init: function () {
|
26
|
+
return this.each(function () {
|
27
|
+
var $element = $(this)
|
28
|
+
, $div
|
29
|
+
, $switchLeft
|
30
|
+
, $switchRight
|
31
|
+
, $label
|
32
|
+
, $form = $element.closest('form')
|
33
|
+
, myClasses = ""
|
34
|
+
, classes = $element.attr('class')
|
35
|
+
, color
|
36
|
+
, moving
|
37
|
+
, onLabel = "ON"
|
38
|
+
, offLabel = "OFF"
|
39
|
+
, icon = false
|
40
|
+
, textLabel = false;
|
41
|
+
|
42
|
+
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
|
43
|
+
if (classes.indexOf(el) >= 0)
|
44
|
+
myClasses = el;
|
45
|
+
});
|
46
|
+
|
47
|
+
$element.addClass('has-switch');
|
48
|
+
|
49
|
+
if ($element.data('on') !== undefined)
|
50
|
+
color = "switch-" + $element.data('on');
|
51
|
+
|
52
|
+
if ($element.data('on-label') !== undefined)
|
53
|
+
onLabel = $element.data('on-label');
|
54
|
+
|
55
|
+
if ($element.data('off-label') !== undefined)
|
56
|
+
offLabel = $element.data('off-label');
|
57
|
+
|
58
|
+
if ($element.data('label-icon') !== undefined)
|
59
|
+
icon = $element.data('label-icon');
|
60
|
+
|
61
|
+
if ($element.data('text-label') !== undefined)
|
62
|
+
textLabel = $element.data('text-label');
|
63
|
+
|
64
|
+
$switchLeft = $('<span>')
|
65
|
+
.addClass("switch-left")
|
66
|
+
.addClass(myClasses)
|
67
|
+
.addClass(color)
|
68
|
+
.html(onLabel);
|
69
|
+
|
70
|
+
color = '';
|
71
|
+
if ($element.data('off') !== undefined)
|
72
|
+
color = "switch-" + $element.data('off');
|
73
|
+
|
74
|
+
$switchRight = $('<span>')
|
75
|
+
.addClass("switch-right")
|
76
|
+
.addClass(myClasses)
|
77
|
+
.addClass(color)
|
78
|
+
.html(offLabel);
|
79
|
+
|
80
|
+
$label = $('<label>')
|
81
|
+
.html(" ")
|
82
|
+
.addClass(myClasses)
|
83
|
+
.attr('for', $element.find(inputSelector).attr('id'));
|
84
|
+
|
85
|
+
if (icon) {
|
86
|
+
$label.html('<i class="icon ' + icon + '"></i>');
|
87
|
+
}
|
88
|
+
|
89
|
+
if (textLabel) {
|
90
|
+
$label.html('' + textLabel + '');
|
91
|
+
}
|
92
|
+
|
93
|
+
$div = $element.find(inputSelector).wrap($('<div>')).parent().data('animated', false);
|
94
|
+
|
95
|
+
if ($element.data('animated') !== false)
|
96
|
+
$div.addClass('switch-animate').data('animated', true);
|
97
|
+
|
98
|
+
$div
|
99
|
+
.append($switchLeft)
|
100
|
+
.append($label)
|
101
|
+
.append($switchRight);
|
102
|
+
|
103
|
+
$element.addClass(
|
104
|
+
$element.find(inputSelector).is(':checked') ? 'switch-on' : 'switch-off'
|
105
|
+
);
|
106
|
+
|
107
|
+
if ($element.find(inputSelector).is(':disabled'))
|
108
|
+
$(this).addClass('deactivate');
|
109
|
+
|
110
|
+
var changeStatus = function ($this) {
|
111
|
+
if ($element.parent('label').is('.label-change-switch')) {
|
112
|
+
|
113
|
+
} else {
|
114
|
+
$this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click');
|
115
|
+
}
|
116
|
+
};
|
117
|
+
|
118
|
+
$element.on('keydown', function (e) {
|
119
|
+
if (e.keyCode === 32) {
|
120
|
+
e.stopImmediatePropagation();
|
121
|
+
e.preventDefault();
|
122
|
+
changeStatus($(e.target).find('span:first'));
|
123
|
+
}
|
124
|
+
});
|
125
|
+
|
126
|
+
$switchLeft.on('click', function (e) {
|
127
|
+
changeStatus($(this));
|
128
|
+
});
|
129
|
+
|
130
|
+
$switchRight.on('click', function (e) {
|
131
|
+
changeStatus($(this));
|
132
|
+
});
|
133
|
+
|
134
|
+
$element.find(inputSelector).on('change', function (e, skipOnChange) {
|
135
|
+
var $this = $(this)
|
136
|
+
, $div = $this.parent()
|
137
|
+
, $element = $div.parent()
|
138
|
+
, thisState = $this.is(':checked')
|
139
|
+
, state = $element.is('.switch-off');
|
140
|
+
|
141
|
+
e.preventDefault();
|
142
|
+
|
143
|
+
$div.css('left', '');
|
144
|
+
|
145
|
+
if (state === thisState) {
|
146
|
+
|
147
|
+
if (thisState)
|
148
|
+
$element.removeClass('switch-off').addClass('switch-on');
|
149
|
+
else $element.removeClass('switch-on').addClass('switch-off');
|
150
|
+
|
151
|
+
if ($div.data('animated') !== false)
|
152
|
+
$div.addClass("switch-animate");
|
153
|
+
|
154
|
+
if (typeof skipOnChange === 'boolean' && skipOnChange)
|
155
|
+
return;
|
156
|
+
|
157
|
+
$element.trigger('switch-change', {'el': $this, 'value': thisState})
|
158
|
+
}
|
159
|
+
});
|
160
|
+
|
161
|
+
$element.find('label').on('mousedown touchstart', function (e) {
|
162
|
+
var $this = $(this);
|
163
|
+
moving = false;
|
164
|
+
|
165
|
+
e.preventDefault();
|
166
|
+
e.stopImmediatePropagation();
|
167
|
+
|
168
|
+
$this.closest('div').removeClass('switch-animate');
|
169
|
+
|
170
|
+
if ($this.closest('.has-switch').is('.deactivate')) {
|
171
|
+
$this.unbind('click');
|
172
|
+
} else if ($this.closest('.switch-on').is('.radio-no-uncheck')) {
|
173
|
+
$this.unbind('click');
|
174
|
+
} else {
|
175
|
+
$this.on('mousemove touchmove', function (e) {
|
176
|
+
var $element = $(this).closest('.make-switch')
|
177
|
+
, relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
|
178
|
+
, percent = (relativeX / $element.width()) * 100
|
179
|
+
, left = 25
|
180
|
+
, right = 75;
|
181
|
+
|
182
|
+
moving = true;
|
183
|
+
|
184
|
+
if (percent < left)
|
185
|
+
percent = left;
|
186
|
+
else if (percent > right)
|
187
|
+
percent = right;
|
188
|
+
|
189
|
+
$element.find('>div').css('left', (percent - right) + "%")
|
190
|
+
});
|
191
|
+
|
192
|
+
$this.on('click touchend', function (e) {
|
193
|
+
var $this = $(this)
|
194
|
+
, $target = $(e.target)
|
195
|
+
, $myRadioCheckBox = $target.siblings('input');
|
196
|
+
|
197
|
+
e.stopImmediatePropagation();
|
198
|
+
e.preventDefault();
|
199
|
+
|
200
|
+
$this.unbind('mouseleave');
|
201
|
+
|
202
|
+
if (moving)
|
203
|
+
$myRadioCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
|
204
|
+
else
|
205
|
+
$myRadioCheckBox.prop("checked", !$myRadioCheckBox.is(":checked"));
|
206
|
+
|
207
|
+
moving = false;
|
208
|
+
$myRadioCheckBox.trigger('change');
|
209
|
+
});
|
210
|
+
|
211
|
+
$this.on('mouseleave', function (e) {
|
212
|
+
var $this = $(this)
|
213
|
+
, $myInputBox = $this.siblings('input');
|
214
|
+
|
215
|
+
e.preventDefault();
|
216
|
+
e.stopImmediatePropagation();
|
217
|
+
|
218
|
+
$this.unbind('mouseleave');
|
219
|
+
$this.trigger('mouseup');
|
220
|
+
|
221
|
+
$myInputBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
|
222
|
+
});
|
223
|
+
|
224
|
+
$this.on('mouseup', function (e) {
|
225
|
+
e.stopImmediatePropagation();
|
226
|
+
e.preventDefault();
|
227
|
+
|
228
|
+
$(this).unbind('mousemove');
|
229
|
+
});
|
230
|
+
}
|
231
|
+
});
|
232
|
+
|
233
|
+
if ($form.data('bootstrapSwitch') !== 'injected') {
|
234
|
+
$form.bind('reset', function () {
|
235
|
+
setTimeout(function () {
|
236
|
+
$form.find('.make-switch').each(function () {
|
237
|
+
var $input = $(this).find(inputSelector);
|
238
|
+
|
239
|
+
$input.prop('checked', $input.is(':checked')).trigger('change');
|
240
|
+
});
|
241
|
+
}, 1);
|
242
|
+
});
|
243
|
+
$form.data('bootstrapSwitch', 'injected');
|
244
|
+
}
|
245
|
+
}
|
246
|
+
);
|
247
|
+
},
|
248
|
+
toggleActivation: function () {
|
249
|
+
var $this = $(this);
|
250
|
+
|
251
|
+
$this.toggleClass('deactivate');
|
252
|
+
$this.find(inputSelector).prop('disabled', $this.is('.deactivate'));
|
253
|
+
},
|
254
|
+
isActive: function () {
|
255
|
+
return !$(this).hasClass('deactivate');
|
256
|
+
},
|
257
|
+
setActive: function (active) {
|
258
|
+
var $this = $(this);
|
259
|
+
|
260
|
+
if (active) {
|
261
|
+
$this.removeClass('deactivate');
|
262
|
+
$this.find(inputSelector).removeAttr('disabled');
|
263
|
+
}
|
264
|
+
else {
|
265
|
+
$this.addClass('deactivate');
|
266
|
+
$this.find(inputSelector).attr('disabled', 'disabled');
|
267
|
+
}
|
268
|
+
},
|
269
|
+
toggleState: function (skipOnChange) {
|
270
|
+
var $input = $(this).find(':checkbox');
|
271
|
+
$input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
|
272
|
+
},
|
273
|
+
toggleRadioState: function (skipOnChange) {
|
274
|
+
var $radioinput = $(this).find(':radio');
|
275
|
+
$radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
|
276
|
+
},
|
277
|
+
toggleRadioStateAllowUncheck: function (uncheck, skipOnChange) {
|
278
|
+
var $radioinput = $(this).find(':radio');
|
279
|
+
if (uncheck) {
|
280
|
+
$radioinput.not(':checked').trigger('change', skipOnChange);
|
281
|
+
}
|
282
|
+
else {
|
283
|
+
$radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
|
284
|
+
}
|
285
|
+
},
|
286
|
+
setState: function (value, skipOnChange) {
|
287
|
+
$(this).find(inputSelector).prop('checked', value).trigger('change', skipOnChange);
|
288
|
+
},
|
289
|
+
setOnLabel: function (value) {
|
290
|
+
var $switchLeft = $(this).find(".switch-left");
|
291
|
+
$switchLeft.html(value);
|
292
|
+
},
|
293
|
+
setOffLabel: function (value) {
|
294
|
+
var $switchRight = $(this).find(".switch-right");
|
295
|
+
$switchRight.html(value);
|
296
|
+
},
|
297
|
+
setOnClass: function (value) {
|
298
|
+
var $switchLeft = $(this).find(".switch-left");
|
299
|
+
var color = '';
|
300
|
+
if (value !== undefined) {
|
301
|
+
if ($(this).attr('data-on') !== undefined) {
|
302
|
+
color = "switch-" + $(this).attr('data-on')
|
303
|
+
}
|
304
|
+
$switchLeft.removeClass(color);
|
305
|
+
color = "switch-" + value;
|
306
|
+
$switchLeft.addClass(color);
|
307
|
+
}
|
308
|
+
},
|
309
|
+
setOffClass: function (value) {
|
310
|
+
var $switchRight = $(this).find(".switch-right");
|
311
|
+
var color = '';
|
312
|
+
if (value !== undefined) {
|
313
|
+
if ($(this).attr('data-off') !== undefined) {
|
314
|
+
color = "switch-" + $(this).attr('data-off')
|
315
|
+
}
|
316
|
+
$switchRight.removeClass(color);
|
317
|
+
color = "switch-" + value;
|
318
|
+
$switchRight.addClass(color);
|
319
|
+
}
|
320
|
+
},
|
321
|
+
setAnimated: function (value) {
|
322
|
+
var $element = $(this).find(inputSelector).parent();
|
323
|
+
if (value === undefined) value = false;
|
324
|
+
$element.data('animated', value);
|
325
|
+
$element.attr('data-animated', value);
|
326
|
+
|
327
|
+
if ($element.data('animated') !== false) {
|
328
|
+
$element.addClass("switch-animate");
|
329
|
+
} else {
|
330
|
+
$element.removeClass("switch-animate");
|
331
|
+
}
|
332
|
+
},
|
333
|
+
setSizeClass: function (value) {
|
334
|
+
var $element = $(this);
|
335
|
+
var $switchLeft = $element.find(".switch-left");
|
336
|
+
var $switchRight = $element.find(".switch-right");
|
337
|
+
var $label = $element.find("label");
|
338
|
+
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
|
339
|
+
if (el !== value) {
|
340
|
+
$switchLeft.removeClass(el)
|
341
|
+
$switchRight.removeClass(el);
|
342
|
+
$label.removeClass(el);
|
343
|
+
} else {
|
344
|
+
$switchLeft.addClass(el);
|
345
|
+
$switchRight.addClass(el);
|
346
|
+
$label.addClass(el);
|
347
|
+
}
|
348
|
+
});
|
349
|
+
},
|
350
|
+
status: function () {
|
351
|
+
return $(this).find(inputSelector).is(':checked');
|
352
|
+
},
|
353
|
+
destroy: function () {
|
354
|
+
var $element = $(this)
|
355
|
+
, $div = $element.find('div')
|
356
|
+
, $form = $element.closest('form')
|
357
|
+
, $inputbox;
|
358
|
+
|
359
|
+
$div.find(':not(input)').remove();
|
360
|
+
|
361
|
+
$inputbox = $div.children();
|
362
|
+
$inputbox.unwrap().unwrap();
|
363
|
+
|
364
|
+
$inputbox.unbind('change');
|
365
|
+
|
366
|
+
if ($form) {
|
367
|
+
$form.unbind('reset');
|
368
|
+
$form.removeData('bootstrapSwitch');
|
369
|
+
}
|
370
|
+
|
371
|
+
return $inputbox;
|
372
|
+
}
|
373
|
+
};
|
374
|
+
|
375
|
+
if (methods[method])
|
376
|
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
377
|
+
else if (typeof method === 'object' || !method)
|
378
|
+
return methods.init.apply(this, arguments);
|
379
|
+
else
|
380
|
+
$.error('Method ' + method + ' does not exist!');
|
381
|
+
};
|
382
|
+
}(jQuery);
|
383
|
+
|
384
|
+
(function ($) {
|
385
|
+
$(function () {
|
386
|
+
$('.make-switch')['bootstrapSwitch']();
|
387
|
+
});
|
388
|
+
})(jQuery);
|