creative_tim 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/creative_tim/version.rb +1 -1
  3. data/vendor/assets/javascripts/creative-tim/{awesome-landing-page.js → awesome_landing_page/awesome-landing-page.js} +0 -0
  4. data/vendor/assets/javascripts/creative-tim/{gaia.js → gaia/gaia.js} +0 -0
  5. data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-checkbox-radio-switch.js +502 -0
  6. data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-notify.js +404 -0
  7. data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-select.js +438 -0
  8. data/vendor/assets/javascripts/creative-tim/light_dashboard/chartist.min.js +9 -0
  9. data/vendor/assets/javascripts/creative-tim/light_dashboard/demo.js +152 -0
  10. data/vendor/assets/javascripts/creative-tim/light_dashboard/light-bootstrap-dashboard.js +159 -0
  11. data/vendor/assets/javascripts/creative-tim/paper_dashboard/bootstrap-checkbox-radio.js +179 -179
  12. data/vendor/assets/javascripts/creative-tim/paper_kit/bootstrap-datepicker.js +492 -0
  13. data/vendor/assets/javascripts/creative-tim/paper_kit/bootstrap-select.js +438 -0
  14. data/vendor/assets/javascripts/creative-tim/paper_kit/ct-paper-checkbox.js +109 -0
  15. data/vendor/assets/javascripts/creative-tim/paper_kit/ct-paper-radio.js +140 -0
  16. data/vendor/assets/javascripts/creative-tim/paper_kit/ct-paper.js +378 -0
  17. data/vendor/assets/javascripts/creative-tim/shit_done/custom.js +9 -0
  18. data/vendor/assets/javascripts/creative-tim/shit_done/get-shit-done.js +108 -0
  19. data/vendor/assets/javascripts/creative-tim/shit_done/gsdk-bootstrapswitch.js +249 -0
  20. data/vendor/assets/javascripts/creative-tim/shit_done/gsdk-checkbox.js +109 -0
  21. data/vendor/assets/javascripts/creative-tim/shit_done/gsdk-radio.js +140 -0
  22. data/vendor/assets/stylesheets/creative-tim/{awesome_landing → awesome_landing_page}/landing-page.css +41 -41
  23. data/vendor/assets/stylesheets/creative-tim/awesome_landing_page/pe-icon-7-stroke.css +632 -0
  24. data/vendor/assets/stylesheets/creative-tim/light_dashboard/animate.min.css +6 -0
  25. data/vendor/assets/stylesheets/creative-tim/light_dashboard/demo.css +61 -0
  26. data/vendor/assets/stylesheets/creative-tim/light_dashboard/light-bootstrap-dashboard.css +3393 -0
  27. data/vendor/assets/stylesheets/creative-tim/light_dashboard/pe-icon-7-stroke.css +632 -0
  28. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/paper-dashboard.css +2 -2
  29. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_alerts.scss +0 -23
  30. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_buttons.scss +7 -1
  31. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_carousel.scss +59 -0
  32. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_checkbox-radio.scss +10 -13
  33. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_collapse.scss +30 -0
  34. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_datepicker.scss +221 -0
  35. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_dropdown.scss +2 -0
  36. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_images.scss +28 -0
  37. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_inputs.scss +5 -38
  38. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_labels.scss +26 -0
  39. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_misc.scss +127 -0
  40. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_mixins.scss +1 -4
  41. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_modal.scss +54 -0
  42. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_navbars.scss +117 -13
  43. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_progress-bars.scss +27 -0
  44. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_responsive.scss +124 -218
  45. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_sections.scss +38 -0
  46. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_sliders.scss +222 -0
  47. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_tabs-navs-pagination.scss +353 -0
  48. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_tooltips-and-popovers.scss +171 -0
  49. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_typography.scss +7 -41
  50. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_variables.scss +55 -79
  51. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_buttons.scss +1 -0
  52. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_inputs.scss +0 -0
  53. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_labels.scss +0 -0
  54. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_navbars.scss +0 -0
  55. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_tabs.scss +0 -0
  56. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_transparency.scss +0 -0
  57. data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_vendor-prefixes.scss +0 -12
  58. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper.css +3323 -0
  59. data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper.scss +34 -0
  60. data/vendor/assets/stylesheets/creative-tim/paper_kit/demo.css +994 -0
  61. data/vendor/assets/stylesheets/creative-tim/paper_kit/examples.css +179 -0
  62. data/vendor/assets/stylesheets/creative-tim/paper_kit/examples.scss +150 -0
  63. data/vendor/assets/stylesheets/creative-tim/shit_done/demo.css +324 -0
  64. data/vendor/assets/stylesheets/creative-tim/shit_done/get-shit-done.css +7 -0
  65. data/vendor/assets/stylesheets/creative-tim/shit_done/gsdk-base.css +1187 -0
  66. data/vendor/assets/stylesheets/creative-tim/shit_done/gsdk-checkbox-radio-switch.css +257 -0
  67. data/vendor/assets/stylesheets/creative-tim/shit_done/gsdk-sliders.css +220 -0
  68. metadata +64 -39
  69. data/vendor/assets/javascripts/creative-tim/paper_dashboard/bootstrap.min.js +0 -7
  70. data/vendor/assets/javascripts/creative-tim/paper_dashboard/jquery-1.10.2.js +0 -9789
  71. data/vendor/assets/stylesheets/creative-tim/awesome_landing/bootstrap.css +0 -6358
  72. data/vendor/assets/stylesheets/creative-tim/awesome_landing/fixes.scss +0 -39
  73. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/bootstrap.min.css +0 -5
  74. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/fixes.scss +0 -45
  75. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_cards.scss +0 -243
  76. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_chartist.scss +0 -230
  77. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_footers.scss +0 -43
  78. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_misc.scss +0 -69
  79. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_sidebar-and-main-panel.scss +0 -195
  80. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_tables.scss +0 -77
  81. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_cards.scss +0 -8
  82. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_chartist.scss +0 -104
  83. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_icons.scss +0 -13
  84. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_sidebar.scss +0 -42
  85. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper-dashboard.scss +0 -28
  86. data/vendor/assets/stylesheets/creative-tim/paper_dashboard/themify-icons.css +0 -1081
@@ -0,0 +1,438 @@
1
+ !function($) {
2
+ var Selectpicker = function(element, options, e) {
3
+ if (e ) {
4
+ e.stopPropagation();
5
+ e.preventDefault();
6
+ }
7
+ this.$element = $(element);
8
+ this.$newElement = null;
9
+ this.button = null;
10
+
11
+ //Merge defaults, options and data-attributes to make our options
12
+ this.options = $.extend({}, $.fn.selectpicker.defaults, this.$element.data(), typeof options == 'object' && options);
13
+
14
+ //If we have no title yet, check the attribute 'title' (this is missed by jq as its not a data-attribute
15
+ if(this.options.title==null)
16
+ this.options.title = this.$element.attr('title');
17
+
18
+ //Expose public methods
19
+ this.val = Selectpicker.prototype.val;
20
+ this.render = Selectpicker.prototype.render;
21
+ this.init();
22
+ };
23
+
24
+ Selectpicker.prototype = {
25
+
26
+ constructor: Selectpicker,
27
+
28
+ init: function (e) {
29
+ var _this = this;
30
+ this.$element.hide();
31
+ this.multiple = this.$element.prop('multiple');
32
+
33
+
34
+ var classList = this.$element.attr('class') !== undefined ? this.$element.attr('class').split(/\s+/) : '';
35
+ var id = this.$element.attr('id');
36
+ this.$element.after( this.createView() );
37
+ this.$newElement = this.$element.next('.select');
38
+ var select = this.$newElement;
39
+ var menu = this.$newElement.find('.dropdown-menu');
40
+ var menuArrow = this.$newElement.find('.dropdown-arrow');
41
+ var menuA = menu.find('li > a');
42
+ var liHeight = select.addClass('open').find('.dropdown-menu li > a').outerHeight();
43
+ select.removeClass('open');
44
+ var divHeight = menu.find('li .divider').outerHeight(true);
45
+ var selectOffset_top = this.$newElement.offset().top;
46
+ var size = 0;
47
+ var menuHeight = 0;
48
+ var selectHeight = this.$newElement.outerHeight();
49
+ this.button = this.$newElement.find('> button');
50
+ if (id !== undefined) {
51
+ this.button.attr('id', id);
52
+ $('label[for="' + id + '"]').click(function(){ select.find('button#'+id).focus(); })
53
+ }
54
+ for (var i = 0; i < classList.length; i++) {
55
+ if(classList[i] != 'selectpicker') {
56
+ this.$newElement.addClass(classList[i]);
57
+ }
58
+ }
59
+ //If we are multiple, then add the show-tick class by default
60
+ if(this.multiple) {
61
+ this.$newElement.addClass('select-multiple');
62
+ }
63
+ this.button.addClass(this.options.style);
64
+ menu.addClass(this.options.menuStyle);
65
+ menuArrow.addClass(function() {
66
+ if (_this.options.menuStyle) {
67
+ return _this.options.menuStyle.replace('dropdown-', 'dropdown-arrow-');
68
+ }
69
+ });
70
+ this.checkDisabled();
71
+ this.checkTabIndex();
72
+ this.clickListener();
73
+ var menuPadding = parseInt(menu.css('padding-top')) + parseInt(menu.css('padding-bottom')) + parseInt(menu.css('border-top-width')) + parseInt(menu.css('border-bottom-width'));
74
+ if (this.options.size == 'auto') {
75
+
76
+ // Creative Tim Changes: We changed the regular function made in bootstrap-select with this function so the getSize() will not be triggered one million times per second while you scroll.
77
+
78
+ var getSize = debounce(function() {
79
+ var selectOffset_top_scroll = selectOffset_top - $(window).scrollTop();
80
+ var windowHeight = $(window).innerHeight();
81
+ var menuExtras = menuPadding + parseInt(menu.css('margin-top')) + parseInt(menu.css('margin-bottom')) + 2;
82
+ var selectOffset_bot = windowHeight - selectOffset_top_scroll - selectHeight - menuExtras;
83
+ menuHeight = selectOffset_bot;
84
+ if (select.hasClass('dropup')) {
85
+ menuHeight = selectOffset_top_scroll - menuExtras;
86
+ }
87
+ //limit menuHeight to 300px to have a smooth transition with cubic bezier on dropdown
88
+ if(menuHeight >= 300){
89
+ menuHeight = 300;
90
+ }
91
+
92
+ menu.css({'max-height' : menuHeight + 'px', 'overflow-y' : 'auto', 'min-height' : liHeight * 3 + 'px'});
93
+
94
+ }, 50);
95
+
96
+ getSize;
97
+ $(window).on('scroll', getSize);
98
+ $(window).on('resize', getSize);
99
+
100
+ if (window.MutationObserver) {
101
+ new MutationObserver(getSize).observe(this.$element.get(0), {
102
+ childList: true
103
+ });
104
+ } else {
105
+ this.$element.bind('DOMNodeInserted', getSize);
106
+ }
107
+ } else if (this.options.size && this.options.size != 'auto' && menu.find('li').length > this.options.size) {
108
+ var optIndex = menu.find("li > *").filter(':not(.divider)').slice(0,this.options.size).last().parent().index();
109
+ var divLength = menu.find("li").slice(0,optIndex + 1).find('.divider').length;
110
+ menuHeight = liHeight*this.options.size + divLength*divHeight + menuPadding;
111
+ menu.css({'max-height' : menuHeight + 'px', 'overflow-y' : 'scroll'});
112
+ //console.log('sunt in if');
113
+ }
114
+
115
+ // Listen for updates to the DOM and re render... (Use Mutation Observer when availiable)
116
+ if (window.MutationObserver) {
117
+ new MutationObserver($.proxy(this.reloadLi, this)).observe(this.$element.get(0), {
118
+ childList: true
119
+ });
120
+ } else {
121
+ this.$element.bind('DOMNodeInserted', $.proxy(this.reloadLi, this));
122
+ }
123
+
124
+ this.render();
125
+ },
126
+
127
+ createDropdown: function() {
128
+ var drop =
129
+ "<div class='btn-group select'>" +
130
+ "<button class='btn dropdown-toggle clearfix' data-toggle='dropdown'>" +
131
+ "<span class='filter-option'></span>&nbsp;" +
132
+ "<span class='caret'></span>" +
133
+ "</button>" +
134
+ "<span class='dropdown-arrow'></span>" +
135
+ "<ul class='dropdown-menu' role='menu'>" +
136
+ "</ul>" +
137
+ "</div>";
138
+
139
+ return $(drop);
140
+ },
141
+
142
+
143
+ createView: function() {
144
+ var $drop = this.createDropdown();
145
+ var $li = this.createLi();
146
+ $drop.find('ul').append($li);
147
+ return $drop;
148
+ },
149
+
150
+ reloadLi: function() {
151
+ //Remove all children.
152
+ this.destroyLi();
153
+ //Re build
154
+ $li = this.createLi();
155
+ this.$newElement.find('ul').append( $li );
156
+ //render view
157
+ this.render();
158
+ },
159
+
160
+ destroyLi:function() {
161
+ this.$newElement.find('li').remove();
162
+ },
163
+
164
+ createLi: function() {
165
+
166
+ var _this = this;
167
+ var _li = [];
168
+ var _liA = [];
169
+ var _liHtml = '';
170
+
171
+ this.$element.find('option').each(function(){
172
+ _li.push($(this).text());
173
+ });
174
+
175
+ this.$element.find('option').each(function(index) {
176
+ //Get the class and text for the option
177
+ var optionClass = $(this).attr("class") !== undefined ? $(this).attr("class") : '';
178
+ var text = $(this).text();
179
+ var subtext = $(this).data('subtext') !== undefined ? '<small class="muted">'+$(this).data('subtext')+'</small>' : '';
180
+
181
+ //Append any subtext to the main text.
182
+ text+=subtext;
183
+
184
+ if ($(this).parent().is('optgroup') && $(this).data('divider') != true) {
185
+ if ($(this).index() == 0) {
186
+ //Get the opt group label
187
+ var label = $(this).parent().attr('label');
188
+ var labelSubtext = $(this).parent().data('subtext') !== undefined ? '<small class="muted">'+$(this).parent().data('subtext')+'</small>' : '';
189
+ label += labelSubtext;
190
+
191
+ if ($(this)[0].index != 0) {
192
+ _liA.push(
193
+ '<div class="divider"></div>'+
194
+ '<dt>'+label+'</dt>'+
195
+ _this.createA(text, "opt " + optionClass )
196
+ );
197
+ } else {
198
+ _liA.push(
199
+ '<dt>'+label+'</dt>'+
200
+ _this.createA(text, "opt " + optionClass ));
201
+ }
202
+ } else {
203
+ _liA.push( _this.createA(text, "opt " + optionClass ) );
204
+ }
205
+ } else if ($(this).data('divider') == true) {
206
+ _liA.push('<div class="divider"></div>');
207
+ } else if ($(this).data('hidden') == true) {
208
+ _liA.push('');
209
+ } else {
210
+ _liA.push( _this.createA(text, optionClass ) );
211
+ }
212
+ });
213
+
214
+ if (_li.length > 0) {
215
+ for (var i = 0; i < _li.length; i++) {
216
+ var $option = this.$element.find('option').eq(i);
217
+ _liHtml += "<li rel=" + i + ">" + _liA[i] + "</li>";
218
+ }
219
+ }
220
+
221
+ //If we dont have a selected item, and we dont have a title, select the first element so something is set in the button
222
+ if(this.$element.find('option:selected').length==0 && !_this.options.title) {
223
+ this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
224
+ }
225
+
226
+ return $(_liHtml);
227
+ },
228
+
229
+ createA:function(test, classes) {
230
+ return '<a tabindex="-1" href="#" class="'+classes+'">' +
231
+ '<span class="">' + test + '</span>' +
232
+ '</a>';
233
+
234
+ },
235
+
236
+ render:function() {
237
+ var _this = this;
238
+
239
+ //Set width of select
240
+ if (this.options.width == 'auto') {
241
+ var ulWidth = this.$newElement.find('.dropdown-menu').css('width');
242
+ this.$newElement.css('width',ulWidth);
243
+ } else if (this.options.width && this.options.width != 'auto') {
244
+ this.$newElement.css('width',this.options.width);
245
+ }
246
+
247
+ //Update the LI to match the SELECT
248
+ this.$element.find('option').each(function(index) {
249
+ _this.setDisabled(index, $(this).is(':disabled') || $(this).parent().is(':disabled') );
250
+ _this.setSelected(index, $(this).is(':selected') );
251
+ });
252
+
253
+
254
+
255
+ var selectedItems = this.$element.find('option:selected').map(function(index,value) {
256
+ if($(this).attr('title')!=undefined) {
257
+ return $(this).attr('title');
258
+ } else {
259
+ return $(this).text();
260
+ }
261
+ }).toArray();
262
+
263
+ //Convert all the values into a comma delimited string
264
+ var title = selectedItems.join(", ");
265
+
266
+ //If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
267
+ if(_this.multiple && _this.options.selectedTextFormat.indexOf('count') > -1) {
268
+ var max = _this.options.selectedTextFormat.split(">");
269
+ if( (max.length>1 && selectedItems.length > max[1]) || (max.length==1 && selectedItems.length>=2)) {
270
+ title = selectedItems.length +' of ' + this.$element.find('option').length + ' selected';
271
+ }
272
+ }
273
+
274
+ //If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
275
+ if(!title) {
276
+ title = _this.options.title != undefined ? _this.options.title : _this.options.noneSelectedText;
277
+ }
278
+
279
+ this.$element.next('.select').find('.filter-option').html( title );
280
+ },
281
+
282
+
283
+
284
+ setSelected:function(index, selected) {
285
+ if(selected) {
286
+ this.$newElement.find('li').eq(index).addClass('selected');
287
+ } else {
288
+ this.$newElement.find('li').eq(index).removeClass('selected');
289
+ }
290
+ },
291
+
292
+ setDisabled:function(index, disabled) {
293
+ if(disabled) {
294
+ this.$newElement.find('li').eq(index).addClass('disabled');
295
+ } else {
296
+ this.$newElement.find('li').eq(index).removeClass('disabled');
297
+ }
298
+ },
299
+
300
+ checkDisabled: function() {
301
+ if (this.$element.is(':disabled')) {
302
+ this.button.addClass('disabled');
303
+ this.button.click(function(e) {
304
+ e.preventDefault();
305
+ });
306
+ }
307
+ },
308
+
309
+ checkTabIndex: function() {
310
+ if (this.$element.is('[tabindex]')) {
311
+ var tabindex = this.$element.attr("tabindex");
312
+ this.button.attr('tabindex', tabindex);
313
+ }
314
+ },
315
+
316
+ clickListener: function() {
317
+ var _this = this;
318
+
319
+ $('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
320
+
321
+
322
+
323
+ this.$newElement.on('click', 'li a', function(e){
324
+ var clickedIndex = $(this).parent().index(),
325
+ $this = $(this).parent(),
326
+ $select = $this.parents('.select');
327
+
328
+
329
+ //Dont close on multi choice menu
330
+ if(_this.multiple) {
331
+ e.stopPropagation();
332
+ }
333
+
334
+ e.preventDefault();
335
+
336
+ //Dont run if we have been disabled
337
+ if ($select.prev('select').not(':disabled') && !$(this).parent().hasClass('disabled')){
338
+ //Deselect all others if not multi select box
339
+ if (!_this.multiple) {
340
+ $select.prev('select').find('option').removeAttr('selected');
341
+ $select.prev('select').find('option').eq(clickedIndex).prop('selected', true).attr('selected', 'selected');
342
+ }
343
+ //Else toggle the one we have chosen if we are multi selet.
344
+ else {
345
+ var selected = $select.prev('select').find('option').eq(clickedIndex).prop('selected');
346
+
347
+ if(selected) {
348
+ $select.prev('select').find('option').eq(clickedIndex).removeAttr('selected');
349
+ } else {
350
+ $select.prev('select').find('option').eq(clickedIndex).prop('selected', true).attr('selected', 'selected');
351
+ }
352
+ }
353
+
354
+
355
+ $select.find('.filter-option').html($this.text());
356
+ $select.find('button').focus();
357
+
358
+ // Trigger select 'change'
359
+ $select.prev('select').trigger('change');
360
+ }
361
+
362
+ });
363
+
364
+ this.$newElement.on('click', 'li.disabled a, li dt, li .divider', function(e) {
365
+ e.preventDefault();
366
+ e.stopPropagation();
367
+ $select = $(this).parent().parents('.select');
368
+ $select.find('button').focus();
369
+ });
370
+
371
+ this.$element.on('change', function(e) {
372
+ _this.render();
373
+ });
374
+ },
375
+
376
+ val:function(value) {
377
+
378
+ if(value!=undefined) {
379
+ this.$element.val( value );
380
+
381
+ this.$element.trigger('change');
382
+ return this.$element;
383
+ } else {
384
+ return this.$element.val();
385
+ }
386
+ }
387
+
388
+ };
389
+
390
+ $.fn.selectpicker = function(option, event) {
391
+ //get the args of the outer function..
392
+ var args = arguments;
393
+ var value;
394
+ var chain = this.each(function () {
395
+ var $this = $(this),
396
+ data = $this.data('selectpicker'),
397
+ options = typeof option == 'object' && option;
398
+
399
+ if (!data) {
400
+ $this.data('selectpicker', (data = new Selectpicker(this, options, event)));
401
+ } else {
402
+ for(var i in option) {
403
+ data[i]=option[i];
404
+ }
405
+ }
406
+
407
+ if (typeof option == 'string') {
408
+ //Copy the value of option, as once we shift the arguments
409
+ //it also shifts the value of option.
410
+ property = option;
411
+ if(data[property] instanceof Function) {
412
+ [].shift.apply(args);
413
+ value = data[property].apply(data, args);
414
+ } else {
415
+ value = data[property];
416
+ }
417
+ }
418
+ });
419
+
420
+ if(value!=undefined) {
421
+ return value;
422
+ } else {
423
+ return chain;
424
+ }
425
+ };
426
+
427
+ $.fn.selectpicker.defaults = {
428
+ style: null,
429
+ size: 'auto',
430
+ title: null,
431
+ selectedTextFormat : 'values',
432
+ noneSelectedText : 'Nothing selected',
433
+ width: null,
434
+ menuStyle: null,
435
+ toggleSize: null
436
+ }
437
+
438
+ }(window.jQuery);
@@ -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 fa-base"></span><span class="second-icon fa fa-check-square fa-base"></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
+