creative_tim 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/creative_tim/version.rb +1 -1
- data/vendor/assets/javascripts/creative-tim/{awesome-landing-page.js → awesome_landing_page/awesome-landing-page.js} +0 -0
- data/vendor/assets/javascripts/creative-tim/{gaia.js → gaia/gaia.js} +0 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-checkbox-radio-switch.js +502 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-notify.js +404 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-select.js +438 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/chartist.min.js +9 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/demo.js +152 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/light-bootstrap-dashboard.js +159 -0
- data/vendor/assets/javascripts/creative-tim/paper_dashboard/bootstrap-checkbox-radio.js +179 -179
- data/vendor/assets/javascripts/creative-tim/paper_kit/bootstrap-datepicker.js +492 -0
- data/vendor/assets/javascripts/creative-tim/paper_kit/bootstrap-select.js +438 -0
- data/vendor/assets/javascripts/creative-tim/paper_kit/ct-paper-checkbox.js +109 -0
- data/vendor/assets/javascripts/creative-tim/paper_kit/ct-paper-radio.js +140 -0
- data/vendor/assets/javascripts/creative-tim/paper_kit/ct-paper.js +378 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/custom.js +9 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/get-shit-done.js +108 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/gsdk-bootstrapswitch.js +249 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/gsdk-checkbox.js +109 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/gsdk-radio.js +140 -0
- data/vendor/assets/stylesheets/creative-tim/{awesome_landing → awesome_landing_page}/landing-page.css +41 -41
- data/vendor/assets/stylesheets/creative-tim/awesome_landing_page/pe-icon-7-stroke.css +632 -0
- data/vendor/assets/stylesheets/creative-tim/light_dashboard/animate.min.css +6 -0
- data/vendor/assets/stylesheets/creative-tim/light_dashboard/demo.css +61 -0
- data/vendor/assets/stylesheets/creative-tim/light_dashboard/light-bootstrap-dashboard.css +3393 -0
- data/vendor/assets/stylesheets/creative-tim/light_dashboard/pe-icon-7-stroke.css +632 -0
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/paper-dashboard.css +2 -2
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_alerts.scss +0 -23
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_buttons.scss +7 -1
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_carousel.scss +59 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_checkbox-radio.scss +10 -13
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_collapse.scss +30 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_datepicker.scss +221 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_dropdown.scss +2 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_images.scss +28 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_inputs.scss +5 -38
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_labels.scss +26 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_misc.scss +127 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_mixins.scss +1 -4
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_modal.scss +54 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_navbars.scss +117 -13
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_progress-bars.scss +27 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_responsive.scss +124 -218
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_sections.scss +38 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_sliders.scss +222 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_tabs-navs-pagination.scss +353 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_tooltips-and-popovers.scss +171 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_typography.scss +7 -41
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_variables.scss +55 -79
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_buttons.scss +1 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_inputs.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_labels.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_navbars.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_tabs.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_transparency.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_vendor-prefixes.scss +0 -12
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper.css +3323 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper.scss +34 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/demo.css +994 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/examples.css +179 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/examples.scss +150 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/demo.css +324 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/get-shit-done.css +7 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/gsdk-base.css +1187 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/gsdk-checkbox-radio-switch.css +257 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/gsdk-sliders.css +220 -0
- metadata +64 -39
- data/vendor/assets/javascripts/creative-tim/paper_dashboard/bootstrap.min.js +0 -7
- data/vendor/assets/javascripts/creative-tim/paper_dashboard/jquery-1.10.2.js +0 -9789
- data/vendor/assets/stylesheets/creative-tim/awesome_landing/bootstrap.css +0 -6358
- data/vendor/assets/stylesheets/creative-tim/awesome_landing/fixes.scss +0 -39
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/bootstrap.min.css +0 -5
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/fixes.scss +0 -45
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_cards.scss +0 -243
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_chartist.scss +0 -230
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_footers.scss +0 -43
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_misc.scss +0 -69
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_sidebar-and-main-panel.scss +0 -195
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_tables.scss +0 -77
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_cards.scss +0 -8
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_chartist.scss +0 -104
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_icons.scss +0 -13
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_sidebar.scss +0 -42
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper-dashboard.scss +0 -28
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/themify-icons.css +0 -1081
@@ -0,0 +1,108 @@
|
|
1
|
+
searchVisible = 0;
|
2
|
+
transparent = true;
|
3
|
+
|
4
|
+
$(document).ready(function(){
|
5
|
+
/* Activate the switches with icons */
|
6
|
+
$('.switch')['bootstrapSwitch']();
|
7
|
+
|
8
|
+
/* Activate regular switches */
|
9
|
+
$("[data-toggle='switch']").wrap('<div class="switch" />').parent().bootstrapSwitch();
|
10
|
+
|
11
|
+
$('[data-toggle="search"]').click(function(){
|
12
|
+
if(searchVisible == 0){
|
13
|
+
searchVisible = 1;
|
14
|
+
$(this).parent().addClass('active');
|
15
|
+
$('.navbar-search-form').fadeIn(function(){
|
16
|
+
$('.navbar-search-form input').focus();
|
17
|
+
});
|
18
|
+
} else {
|
19
|
+
searchVisible = 0;
|
20
|
+
$(this).parent().removeClass('active');
|
21
|
+
$(this).blur();
|
22
|
+
$('.navbar-search-form').fadeOut(function(){
|
23
|
+
$('.navbar-search-form input').blur();
|
24
|
+
});
|
25
|
+
}
|
26
|
+
});
|
27
|
+
|
28
|
+
$('[data-toggle="gsdk-collapse"]').hover(
|
29
|
+
function(){
|
30
|
+
console.log('on hover');
|
31
|
+
var thisdiv = $(this).attr("data-target");
|
32
|
+
|
33
|
+
if(!$(this).hasClass('state-open')){
|
34
|
+
$(this).addClass('state-hover');
|
35
|
+
$(thisdiv).css({
|
36
|
+
'height':'30px'
|
37
|
+
});
|
38
|
+
}
|
39
|
+
|
40
|
+
},
|
41
|
+
function(){
|
42
|
+
var thisdiv = $(this).attr("data-target");
|
43
|
+
$(this).removeClass('state-hover');
|
44
|
+
|
45
|
+
if(!$(this).hasClass('state-open')){
|
46
|
+
$(thisdiv).css({
|
47
|
+
'height':'0px'
|
48
|
+
});
|
49
|
+
}
|
50
|
+
}
|
51
|
+
);
|
52
|
+
|
53
|
+
$('[data-toggle="gsdk-collapse"]').click(
|
54
|
+
function(event){
|
55
|
+
event.preventDefault();
|
56
|
+
|
57
|
+
var thisdiv = $(this).attr("data-target");
|
58
|
+
var height = $(thisdiv).children('.panel-body').height();
|
59
|
+
|
60
|
+
if($(this).hasClass('state-open')){
|
61
|
+
$(thisdiv).css({
|
62
|
+
'height':'0px',
|
63
|
+
});
|
64
|
+
$(this).removeClass('state-open');
|
65
|
+
} else {
|
66
|
+
$(thisdiv).css({
|
67
|
+
'height':height,
|
68
|
+
});
|
69
|
+
$(this).addClass('state-open');
|
70
|
+
}
|
71
|
+
}
|
72
|
+
);
|
73
|
+
});
|
74
|
+
|
75
|
+
$(function () {
|
76
|
+
$('[data-toggle="gsdk-collapse"]').each(function () {
|
77
|
+
var thisdiv = $(this).attr("data-target");
|
78
|
+
$(thisdiv).addClass("gsdk-collapse");
|
79
|
+
});
|
80
|
+
|
81
|
+
});
|
82
|
+
|
83
|
+
$(document).scroll(function() {
|
84
|
+
if( $(this).scrollTop() > 260 ) {
|
85
|
+
if(transparent) {
|
86
|
+
transparent = false;
|
87
|
+
$('nav[role="navigation"]').removeClass('navbar-transparent');
|
88
|
+
}
|
89
|
+
} else {
|
90
|
+
if( !transparent ) {
|
91
|
+
transparent = true;
|
92
|
+
$('nav[role="navigation"]').addClass('navbar-transparent');
|
93
|
+
}
|
94
|
+
}
|
95
|
+
});
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
@@ -0,0 +1,249 @@
|
|
1
|
+
/* ============================================================
|
2
|
+
* bootstrapSwitch v1.3 by Larentis Mattia @spiritualGuru
|
3
|
+
* http://www.larentis.eu/switch/
|
4
|
+
* ============================================================
|
5
|
+
* Licensed under the Apache License, Version 2.0
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
* ============================================================ */
|
8
|
+
|
9
|
+
!function ($) {
|
10
|
+
"use strict";
|
11
|
+
|
12
|
+
$.fn['bootstrapSwitch'] = function (method) {
|
13
|
+
var methods = {
|
14
|
+
init: function () {
|
15
|
+
return this.each(function () {
|
16
|
+
var $element = $(this)
|
17
|
+
, $div
|
18
|
+
, $switchLeft
|
19
|
+
, $switchRight
|
20
|
+
, $label
|
21
|
+
, myClasses = ""
|
22
|
+
, classes = $element.attr('class')
|
23
|
+
, color
|
24
|
+
, moving
|
25
|
+
, onLabel = "ON"
|
26
|
+
, offLabel = "OFF"
|
27
|
+
, icon = false;
|
28
|
+
|
29
|
+
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
|
30
|
+
if (classes.indexOf(el) >= 0)
|
31
|
+
myClasses = el;
|
32
|
+
});
|
33
|
+
|
34
|
+
$element.addClass('has-switch');
|
35
|
+
|
36
|
+
if ($element.data('on') !== undefined)
|
37
|
+
color = "switch-" + $element.data('on');
|
38
|
+
|
39
|
+
if ($element.data('on-label') !== undefined)
|
40
|
+
onLabel = $element.data('on-label');
|
41
|
+
|
42
|
+
if ($element.data('off-label') !== undefined)
|
43
|
+
offLabel = $element.data('off-label');
|
44
|
+
|
45
|
+
if ($element.data('icon') !== undefined)
|
46
|
+
icon = $element.data('icon');
|
47
|
+
|
48
|
+
$switchLeft = $('<span>')
|
49
|
+
.addClass("switch-left")
|
50
|
+
.addClass(myClasses)
|
51
|
+
.addClass(color)
|
52
|
+
.html(onLabel);
|
53
|
+
|
54
|
+
color = '';
|
55
|
+
if ($element.data('off') !== undefined)
|
56
|
+
color = "switch-" + $element.data('off');
|
57
|
+
|
58
|
+
$switchRight = $('<span>')
|
59
|
+
.addClass("switch-right")
|
60
|
+
.addClass(myClasses)
|
61
|
+
.addClass(color)
|
62
|
+
.html(offLabel);
|
63
|
+
|
64
|
+
$label = $('<label>')
|
65
|
+
.html(" ")
|
66
|
+
.addClass(myClasses)
|
67
|
+
.attr('for', $element.find('input').attr('id'));
|
68
|
+
|
69
|
+
if (icon) {
|
70
|
+
$label.html('<i class="' + icon + '"></i>');
|
71
|
+
}
|
72
|
+
|
73
|
+
$div = $element.find(':checkbox').wrap($('<div>')).parent().data('animated', false);
|
74
|
+
|
75
|
+
if ($element.data('animated') !== false)
|
76
|
+
$div.addClass('switch-animate').data('animated', true);
|
77
|
+
|
78
|
+
$div
|
79
|
+
.append($switchLeft)
|
80
|
+
.append($label)
|
81
|
+
.append($switchRight);
|
82
|
+
|
83
|
+
$element.find('>div').addClass(
|
84
|
+
$element.find('input').is(':checked') ? 'switch-on' : 'switch-off'
|
85
|
+
);
|
86
|
+
|
87
|
+
if ($element.find('input').is(':disabled'))
|
88
|
+
$(this).addClass('deactivate');
|
89
|
+
|
90
|
+
var changeStatus = function ($this) {
|
91
|
+
$this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click');
|
92
|
+
};
|
93
|
+
|
94
|
+
$element.on('keydown', function (e) {
|
95
|
+
if (e.keyCode === 32) {
|
96
|
+
e.stopImmediatePropagation();
|
97
|
+
e.preventDefault();
|
98
|
+
changeStatus($(e.target).find('span:first'));
|
99
|
+
}
|
100
|
+
});
|
101
|
+
|
102
|
+
$switchLeft.on('click', function (e) {
|
103
|
+
changeStatus($(this));
|
104
|
+
});
|
105
|
+
|
106
|
+
$switchRight.on('click', function (e) {
|
107
|
+
changeStatus($(this));
|
108
|
+
});
|
109
|
+
|
110
|
+
$element.find('input').on('change', function (e) {
|
111
|
+
var $this = $(this)
|
112
|
+
, $element = $this.parent()
|
113
|
+
, thisState = $this.is(':checked')
|
114
|
+
, state = $element.is('.switch-off');
|
115
|
+
|
116
|
+
e.preventDefault();
|
117
|
+
|
118
|
+
$element.css('left', '');
|
119
|
+
|
120
|
+
if (state === thisState) {
|
121
|
+
|
122
|
+
if (thisState)
|
123
|
+
$element.removeClass('switch-off').addClass('switch-on');
|
124
|
+
else $element.removeClass('switch-on').addClass('switch-off');
|
125
|
+
|
126
|
+
if ($element.data('animated') !== false)
|
127
|
+
$element.addClass("switch-animate");
|
128
|
+
|
129
|
+
$element.parent().trigger('switch-change', {'el': $this, 'value': thisState})
|
130
|
+
}
|
131
|
+
});
|
132
|
+
|
133
|
+
$element.find('label').on('mousedown touchstart', function (e) {
|
134
|
+
var $this = $(this);
|
135
|
+
moving = false;
|
136
|
+
|
137
|
+
e.preventDefault();
|
138
|
+
e.stopImmediatePropagation();
|
139
|
+
|
140
|
+
$this.closest('div').removeClass('switch-animate');
|
141
|
+
|
142
|
+
if ($this.closest('.has-switch').is('.deactivate'))
|
143
|
+
$this.unbind('click');
|
144
|
+
else {
|
145
|
+
$this.on('mousemove touchmove', function (e) {
|
146
|
+
var $element = $(this).closest('.switch')
|
147
|
+
, relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
|
148
|
+
, percent = (relativeX / $element.width()) * 100
|
149
|
+
, left = 25
|
150
|
+
, right = 75;
|
151
|
+
|
152
|
+
moving = true;
|
153
|
+
|
154
|
+
if (percent < left)
|
155
|
+
percent = left;
|
156
|
+
else if (percent > right)
|
157
|
+
percent = right;
|
158
|
+
|
159
|
+
$element.find('>div').css('left', (percent - right) + "%")
|
160
|
+
});
|
161
|
+
|
162
|
+
$this.on('click touchend', function (e) {
|
163
|
+
var $this = $(this)
|
164
|
+
, $target = $(e.target)
|
165
|
+
, $myCheckBox = $target.siblings('input');
|
166
|
+
|
167
|
+
e.stopImmediatePropagation();
|
168
|
+
e.preventDefault();
|
169
|
+
|
170
|
+
$this.unbind('mouseleave');
|
171
|
+
|
172
|
+
if (moving)
|
173
|
+
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
|
174
|
+
else $myCheckBox.prop("checked", !$myCheckBox.is(":checked"));
|
175
|
+
|
176
|
+
moving = false;
|
177
|
+
$myCheckBox.trigger('change');
|
178
|
+
});
|
179
|
+
|
180
|
+
$this.on('mouseleave', function (e) {
|
181
|
+
var $this = $(this)
|
182
|
+
, $myCheckBox = $this.siblings('input');
|
183
|
+
|
184
|
+
e.preventDefault();
|
185
|
+
e.stopImmediatePropagation();
|
186
|
+
|
187
|
+
$this.unbind('mouseleave');
|
188
|
+
$this.trigger('mouseup');
|
189
|
+
|
190
|
+
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
|
191
|
+
});
|
192
|
+
|
193
|
+
$this.on('mouseup', function (e) {
|
194
|
+
e.stopImmediatePropagation();
|
195
|
+
e.preventDefault();
|
196
|
+
|
197
|
+
$(this).unbind('mousemove');
|
198
|
+
});
|
199
|
+
}
|
200
|
+
});
|
201
|
+
}
|
202
|
+
);
|
203
|
+
},
|
204
|
+
toggleActivation: function () {
|
205
|
+
$(this).toggleClass('deactivate');
|
206
|
+
},
|
207
|
+
isActive: function () {
|
208
|
+
return !$(this).hasClass('deactivate');
|
209
|
+
},
|
210
|
+
setActive: function (active) {
|
211
|
+
if (active)
|
212
|
+
$(this).removeClass('deactivate');
|
213
|
+
else $(this).addClass('deactivate');
|
214
|
+
},
|
215
|
+
toggleState: function (skipOnChange) {
|
216
|
+
var $input = $(this).find('input:checkbox');
|
217
|
+
$input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
|
218
|
+
},
|
219
|
+
setState: function (value, skipOnChange) {
|
220
|
+
$(this).find('input:checkbox').prop('checked', value).trigger('change', skipOnChange);
|
221
|
+
},
|
222
|
+
status: function () {
|
223
|
+
return $(this).find('input:checkbox').is(':checked');
|
224
|
+
},
|
225
|
+
destroy: function () {
|
226
|
+
var $div = $(this).find('div')
|
227
|
+
, $checkbox;
|
228
|
+
|
229
|
+
$div.find(':not(input:checkbox)').remove();
|
230
|
+
|
231
|
+
$checkbox = $div.children();
|
232
|
+
$checkbox.unwrap().unwrap();
|
233
|
+
|
234
|
+
$checkbox.unbind('change');
|
235
|
+
|
236
|
+
return $checkbox;
|
237
|
+
}
|
238
|
+
};
|
239
|
+
|
240
|
+
if (methods[method])
|
241
|
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
242
|
+
else if (typeof method === 'object' || !method)
|
243
|
+
return methods.init.apply(this, arguments);
|
244
|
+
else
|
245
|
+
$.error('Method ' + method + ' does not exist!');
|
246
|
+
};
|
247
|
+
}(jQuery);
|
248
|
+
|
249
|
+
|
@@ -0,0 +1,109 @@
|
|
1
|
+
!function ($) {
|
2
|
+
|
3
|
+
/* CHECKBOX PUBLIC CLASS DEFINITION
|
4
|
+
* ============================== */
|
5
|
+
|
6
|
+
var Checkbox = function (element, options) {
|
7
|
+
this.init(element, options);
|
8
|
+
}
|
9
|
+
|
10
|
+
Checkbox.prototype = {
|
11
|
+
|
12
|
+
constructor: Checkbox
|
13
|
+
|
14
|
+
, init: function (element, options) {
|
15
|
+
var $el = this.$element = $(element)
|
16
|
+
|
17
|
+
this.options = $.extend({}, $.fn.checkbox.defaults, options);
|
18
|
+
$el.before(this.options.template);
|
19
|
+
this.setState();
|
20
|
+
}
|
21
|
+
|
22
|
+
, setState: function () {
|
23
|
+
var $el = this.$element
|
24
|
+
, $parent = $el.closest('.checkbox');
|
25
|
+
|
26
|
+
$el.prop('disabled') && $parent.addClass('disabled');
|
27
|
+
$el.prop('checked') && $parent.addClass('checked');
|
28
|
+
}
|
29
|
+
|
30
|
+
, toggle: function () {
|
31
|
+
var ch = 'checked'
|
32
|
+
, $el = this.$element
|
33
|
+
, $parent = $el.closest('.checkbox')
|
34
|
+
, checked = $el.prop(ch)
|
35
|
+
, e = $.Event('toggle')
|
36
|
+
|
37
|
+
if ($el.prop('disabled') == false) {
|
38
|
+
$parent.toggleClass(ch) && checked ? $el.removeAttr(ch) : $el.prop(ch, ch);
|
39
|
+
$el.trigger(e).trigger('change');
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
, setCheck: function (option) {
|
44
|
+
var d = 'disabled'
|
45
|
+
, ch = 'checked'
|
46
|
+
, $el = this.$element
|
47
|
+
, $parent = $el.closest('.checkbox')
|
48
|
+
, checkAction = option == 'check' ? true : false
|
49
|
+
, e = $.Event(option)
|
50
|
+
|
51
|
+
$parent[checkAction ? 'addClass' : 'removeClass' ](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch);
|
52
|
+
$el.trigger(e).trigger('change');
|
53
|
+
}
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
/* CHECKBOX PLUGIN DEFINITION
|
59
|
+
* ======================== */
|
60
|
+
|
61
|
+
var old = $.fn.checkbox
|
62
|
+
|
63
|
+
$.fn.checkbox = function (option) {
|
64
|
+
return this.each(function () {
|
65
|
+
var $this = $(this)
|
66
|
+
, data = $this.data('checkbox')
|
67
|
+
, options = $.extend({}, $.fn.checkbox.defaults, $this.data(), typeof option == 'object' && option);
|
68
|
+
if (!data) $this.data('checkbox', (data = new Checkbox(this, options)));
|
69
|
+
if (option == 'toggle') data.toggle()
|
70
|
+
if (option == 'check' || option == 'uncheck') data.setCheck(option)
|
71
|
+
else if (option) data.setState();
|
72
|
+
});
|
73
|
+
}
|
74
|
+
|
75
|
+
$.fn.checkbox.defaults = {
|
76
|
+
template: '<span class="icons"><span class="first-icon fa fa-square-o"></span><span class="second-icon fa fa-check-square-o"></span></span>'
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
/* CHECKBOX NO CONFLICT
|
81
|
+
* ================== */
|
82
|
+
|
83
|
+
$.fn.checkbox.noConflict = function () {
|
84
|
+
$.fn.checkbox = old;
|
85
|
+
return this;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
/* CHECKBOX DATA-API
|
90
|
+
* =============== */
|
91
|
+
|
92
|
+
$(document).on('click.checkbox.data-api', '[data-toggle^=checkbox], .checkbox', function (e) {
|
93
|
+
var $checkbox = $(e.target);
|
94
|
+
if (e.target.tagName != "A") {
|
95
|
+
e && e.preventDefault() && e.stopPropagation();
|
96
|
+
if (!$checkbox.hasClass('checkbox')) $checkbox = $checkbox.closest('.checkbox');
|
97
|
+
$checkbox.find(':checkbox').checkbox('toggle');
|
98
|
+
}
|
99
|
+
});
|
100
|
+
|
101
|
+
$(function () {
|
102
|
+
$('[data-toggle="checkbox"]').each(function () {
|
103
|
+
var $checkbox = $(this);
|
104
|
+
$checkbox.checkbox();
|
105
|
+
});
|
106
|
+
});
|
107
|
+
|
108
|
+
}(window.jQuery);
|
109
|
+
|