active_frontend 13.3.0 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.fasterer.yml +19 -0
  4. data/.reek +27 -0
  5. data/.rubocop.yml +38 -0
  6. data/.scss-lint.yml +27 -0
  7. data/Rakefile +1 -1
  8. data/active_frontend.gemspec +21 -18
  9. data/app/.DS_Store +0 -0
  10. data/app/assets/.DS_Store +0 -0
  11. data/app/assets/fonts/.DS_Store +0 -0
  12. data/app/assets/fonts/dripicons/.DS_Store +0 -0
  13. data/app/assets/fonts/dripicons/dripicons.woff +0 -0
  14. data/app/assets/fonts/fakt-pro/.DS_Store +0 -0
  15. data/app/assets/fonts/fakt-pro/fakt-pro-bold.woff +0 -0
  16. data/app/assets/fonts/fakt-pro/fakt-pro-normal.woff +0 -0
  17. data/app/assets/fonts/fakt-pro/fakt-pro-semibold.woff +0 -0
  18. data/app/assets/fonts/fakt-pro/fakt-pro-semilight.woff +0 -0
  19. data/app/assets/fonts/fakt-soft-pro/.DS_Store +0 -0
  20. data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-bold.woff +0 -0
  21. data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-normal.woff +0 -0
  22. data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-semibold.woff +0 -0
  23. data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-semilight.woff +0 -0
  24. data/app/assets/images/.DS_Store +0 -0
  25. data/app/assets/images/.keep +0 -0
  26. data/app/assets/images/placeholders/.DS_Store +0 -0
  27. data/app/assets/images/placeholders/camera-large.png +0 -0
  28. data/app/assets/images/placeholders/camera-small.png +0 -0
  29. data/app/assets/images/placeholders/camera.png +0 -0
  30. data/app/assets/images/placeholders/document-large.png +0 -0
  31. data/app/assets/images/placeholders/document-small.png +0 -0
  32. data/app/assets/images/placeholders/document.png +0 -0
  33. data/app/assets/images/placeholders/photo-large.png +0 -0
  34. data/app/assets/images/placeholders/{picture-small.png → photo-small.png} +0 -0
  35. data/app/assets/images/placeholders/photo.png +0 -0
  36. data/app/assets/images/placeholders/store-large.png +0 -0
  37. data/app/assets/images/placeholders/store-small.png +0 -0
  38. data/app/assets/images/placeholders/store.png +0 -0
  39. data/app/assets/images/placeholders/user-large.png +0 -0
  40. data/app/assets/images/placeholders/user-small.png +0 -0
  41. data/app/assets/images/placeholders/user.png +0 -0
  42. data/app/helpers/active_frontend_helper.rb +22 -37
  43. data/lib/.DS_Store +0 -0
  44. data/lib/active_frontend.rb +3 -4
  45. data/lib/active_frontend/.DS_Store +0 -0
  46. data/lib/active_frontend/version.rb +1 -1
  47. data/lib/generators/active_frontend/install_generator.rb +3 -3
  48. data/lib/generators/active_frontend/templates/install.js +35 -30
  49. data/lib/generators/active_frontend/templates/install.scss +55 -58
  50. data/vendor/.DS_Store +0 -0
  51. data/vendor/assets/.DS_Store +0 -0
  52. data/vendor/assets/javascripts/.DS_Store +0 -0
  53. data/vendor/assets/javascripts/active_frontend.js +35 -30
  54. data/vendor/assets/javascripts/base/_affix.js +170 -0
  55. data/vendor/assets/javascripts/base/_alert.js +80 -0
  56. data/vendor/assets/javascripts/base/_animation.js +106 -0
  57. data/vendor/assets/javascripts/base/_button.js +123 -0
  58. data/vendor/assets/javascripts/base/_carousel.js +237 -0
  59. data/vendor/assets/javascripts/base/_collapse.js +200 -0
  60. data/vendor/assets/javascripts/base/_colorpicker.js +147 -0
  61. data/vendor/assets/javascripts/base/_datepicker.js +1411 -0
  62. data/vendor/assets/javascripts/base/_dropdown.js +154 -0
  63. data/vendor/assets/javascripts/base/_filepicker.js +235 -0
  64. data/vendor/assets/javascripts/base/_hoverdown.js +116 -0
  65. data/vendor/assets/javascripts/base/_layout.js +126 -0
  66. data/vendor/assets/javascripts/base/_list.js +103 -0
  67. data/vendor/assets/javascripts/{_modal.js → base/_modal.js} +170 -167
  68. data/vendor/assets/javascripts/base/_popover.js +101 -0
  69. data/vendor/assets/javascripts/base/_scrollspy.js +161 -0
  70. data/vendor/assets/javascripts/base/_switch.js +160 -0
  71. data/vendor/assets/javascripts/base/_tab.js +139 -0
  72. data/vendor/assets/javascripts/base/_table.js +224 -0
  73. data/vendor/assets/javascripts/base/_timeago.js +270 -0
  74. data/vendor/assets/javascripts/base/_timepicker.js +541 -0
  75. data/vendor/assets/javascripts/base/_tooltip.js +525 -0
  76. data/vendor/assets/javascripts/base/_tour.js +268 -0
  77. data/vendor/assets/javascripts/base/_transition.js +52 -0
  78. data/vendor/assets/javascripts/base/_typeahead.js +362 -0
  79. data/vendor/assets/javascripts/extensions/_calendar.js +4709 -0
  80. data/vendor/assets/javascripts/extensions/_chart.js +9371 -0
  81. data/vendor/assets/javascripts/extensions/_map.js +2153 -0
  82. data/vendor/assets/stylesheets/.DS_Store +0 -0
  83. data/vendor/assets/stylesheets/{_mixin.scss → _utility.scss} +96 -10
  84. data/vendor/assets/stylesheets/_variable.scss +201 -19
  85. data/vendor/assets/stylesheets/active_frontend.scss +55 -58
  86. data/vendor/assets/stylesheets/blocks/_anchor.scss +15 -0
  87. data/vendor/assets/stylesheets/blocks/_button.scss +278 -0
  88. data/vendor/assets/stylesheets/blocks/_code.scss +144 -0
  89. data/vendor/assets/stylesheets/blocks/_common.scss +127 -0
  90. data/vendor/assets/stylesheets/blocks/_form.scss +508 -0
  91. data/vendor/assets/stylesheets/blocks/_icon.scss +359 -0
  92. data/vendor/assets/stylesheets/blocks/_list.scss +76 -0
  93. data/vendor/assets/stylesheets/blocks/_multimedia.scss +62 -0
  94. data/vendor/assets/stylesheets/blocks/_reset.scss +179 -0
  95. data/vendor/assets/stylesheets/blocks/_table.scss +211 -0
  96. data/vendor/assets/stylesheets/blocks/_typography.scss +204 -0
  97. data/vendor/assets/stylesheets/components/_ad.scss +78 -0
  98. data/vendor/assets/stylesheets/components/_affix.scss +14 -0
  99. data/vendor/assets/stylesheets/components/_alert.scss +50 -0
  100. data/vendor/assets/stylesheets/components/_animation.scss +1670 -0
  101. data/vendor/assets/stylesheets/components/_breadcrumb.scss +17 -0
  102. data/vendor/assets/stylesheets/components/_calendar.scss +213 -0
  103. data/vendor/assets/stylesheets/components/_card.scss +30 -0
  104. data/vendor/assets/stylesheets/components/_carousel.scss +135 -0
  105. data/vendor/assets/stylesheets/components/_chart.scss +10 -0
  106. data/vendor/assets/stylesheets/components/_collapse.scss +17 -0
  107. data/vendor/assets/stylesheets/components/_colorpicker.scss +38 -0
  108. data/vendor/assets/stylesheets/components/_datepicker.scss +80 -0
  109. data/vendor/assets/stylesheets/components/_dropmenu.scss +151 -0
  110. data/vendor/assets/stylesheets/components/_footer.scss +11 -0
  111. data/vendor/assets/stylesheets/components/_grid.scss +144 -0
  112. data/vendor/assets/stylesheets/components/_header.scss +99 -0
  113. data/vendor/assets/stylesheets/components/_label_and_badge.scss +57 -0
  114. data/vendor/assets/stylesheets/components/_layout.scss +63 -0
  115. data/vendor/assets/stylesheets/components/_map.scss +14 -0
  116. data/vendor/assets/stylesheets/components/_milestone.scss +49 -0
  117. data/vendor/assets/stylesheets/components/_missive.scss +40 -0
  118. data/vendor/assets/stylesheets/components/_modal.scss +126 -0
  119. data/vendor/assets/stylesheets/components/_nav_and_tab.scss +202 -0
  120. data/vendor/assets/stylesheets/components/_navbar.scss +66 -0
  121. data/vendor/assets/stylesheets/components/_pagination.scss +79 -0
  122. data/vendor/assets/stylesheets/components/_placeholder.scss +23 -0
  123. data/vendor/assets/stylesheets/components/_popover.scss +167 -0
  124. data/vendor/assets/stylesheets/components/_progress.scss +62 -0
  125. data/vendor/assets/stylesheets/components/_sidebar.scss +74 -0
  126. data/vendor/assets/stylesheets/components/_spinner.scss +83 -0
  127. data/vendor/assets/stylesheets/components/_switch.scss +150 -0
  128. data/vendor/assets/stylesheets/components/_timepicker.scss +30 -0
  129. data/vendor/assets/stylesheets/components/_tooltip.scss +93 -0
  130. data/vendor/assets/stylesheets/components/_transition.scss +12 -0
  131. data/vendor/assets/stylesheets/components/_typeahead.scss +18 -0
  132. metadata +150 -94
  133. data/app/assets/fonts/gotham/gotham-bold.woff +0 -0
  134. data/app/assets/fonts/gotham/gotham-book.woff +0 -0
  135. data/app/assets/fonts/gotham/gotham-light.woff +0 -0
  136. data/app/assets/fonts/gotham/gotham-medium.woff +0 -0
  137. data/app/assets/fonts/gotham/gotham-rounded-bold.woff +0 -0
  138. data/app/assets/fonts/gotham/gotham-rounded-book.woff +0 -0
  139. data/app/assets/fonts/gotham/gotham-rounded-light.woff +0 -0
  140. data/app/assets/fonts/gotham/gotham-rounded-medium.woff +0 -0
  141. data/app/assets/images/placeholders/archive-large.png +0 -0
  142. data/app/assets/images/placeholders/archive-small.png +0 -0
  143. data/app/assets/images/placeholders/archive.png +0 -0
  144. data/app/assets/images/placeholders/picture-large.png +0 -0
  145. data/app/assets/images/placeholders/picture.png +0 -0
  146. data/vendor/assets/javascripts/_affix.js +0 -153
  147. data/vendor/assets/javascripts/_alert.js +0 -85
  148. data/vendor/assets/javascripts/_animation.js +0 -103
  149. data/vendor/assets/javascripts/_button.js +0 -107
  150. data/vendor/assets/javascripts/_carousel.js +0 -228
  151. data/vendor/assets/javascripts/_chart.js +0 -3742
  152. data/vendor/assets/javascripts/_collapse.js +0 -202
  153. data/vendor/assets/javascripts/_color_picker.js +0 -108
  154. data/vendor/assets/javascripts/_date_picker.js +0 -1650
  155. data/vendor/assets/javascripts/_dropdown.js +0 -156
  156. data/vendor/assets/javascripts/_file_input.js +0 -71
  157. data/vendor/assets/javascripts/_hoverdown.js +0 -109
  158. data/vendor/assets/javascripts/_inputmask.js +0 -341
  159. data/vendor/assets/javascripts/_loader.js +0 -361
  160. data/vendor/assets/javascripts/_map.js +0 -2401
  161. data/vendor/assets/javascripts/_popover.js +0 -99
  162. data/vendor/assets/javascripts/_scrollspy.js +0 -163
  163. data/vendor/assets/javascripts/_slider.js +0 -1572
  164. data/vendor/assets/javascripts/_sort.js +0 -1432
  165. data/vendor/assets/javascripts/_swoggle.js +0 -415
  166. data/vendor/assets/javascripts/_tab.js +0 -146
  167. data/vendor/assets/javascripts/_tablespy.js +0 -1883
  168. data/vendor/assets/javascripts/_time_ago.js +0 -206
  169. data/vendor/assets/javascripts/_time_picker.js +0 -1088
  170. data/vendor/assets/javascripts/_tooltip.js +0 -504
  171. data/vendor/assets/javascripts/_transition.js +0 -50
  172. data/vendor/assets/javascripts/_typeahead.js +0 -366
  173. data/vendor/assets/stylesheets/_ad.scss +0 -63
  174. data/vendor/assets/stylesheets/_affix.scss +0 -14
  175. data/vendor/assets/stylesheets/_alert.scss +0 -114
  176. data/vendor/assets/stylesheets/_animation.scss +0 -1370
  177. data/vendor/assets/stylesheets/_breadcrumb.scss +0 -100
  178. data/vendor/assets/stylesheets/_button.scss +0 -386
  179. data/vendor/assets/stylesheets/_canvas.scss +0 -182
  180. data/vendor/assets/stylesheets/_carousel.scss +0 -158
  181. data/vendor/assets/stylesheets/_chart.scss +0 -15
  182. data/vendor/assets/stylesheets/_code.scss +0 -150
  183. data/vendor/assets/stylesheets/_collapse.scss +0 -14
  184. data/vendor/assets/stylesheets/_color.scss +0 -55
  185. data/vendor/assets/stylesheets/_colorpicker.scss +0 -63
  186. data/vendor/assets/stylesheets/_datepicker.scss +0 -122
  187. data/vendor/assets/stylesheets/_dropdown.scss +0 -248
  188. data/vendor/assets/stylesheets/_footer.scss +0 -71
  189. data/vendor/assets/stylesheets/_form.scss +0 -661
  190. data/vendor/assets/stylesheets/_grid.scss +0 -184
  191. data/vendor/assets/stylesheets/_header.scss +0 -156
  192. data/vendor/assets/stylesheets/_icon.scss +0 -362
  193. data/vendor/assets/stylesheets/_image.scss +0 -33
  194. data/vendor/assets/stylesheets/_label_and_badge.scss +0 -104
  195. data/vendor/assets/stylesheets/_link.scss +0 -55
  196. data/vendor/assets/stylesheets/_list.scss +0 -122
  197. data/vendor/assets/stylesheets/_loader.scss +0 -71
  198. data/vendor/assets/stylesheets/_map.scss +0 -44
  199. data/vendor/assets/stylesheets/_missive.scss +0 -74
  200. data/vendor/assets/stylesheets/_modal.scss +0 -204
  201. data/vendor/assets/stylesheets/_nav_and_tab.scss +0 -230
  202. data/vendor/assets/stylesheets/_navbar.scss +0 -73
  203. data/vendor/assets/stylesheets/_pagination.scss +0 -79
  204. data/vendor/assets/stylesheets/_panel.scss +0 -80
  205. data/vendor/assets/stylesheets/_placeholder.scss +0 -63
  206. data/vendor/assets/stylesheets/_popover.scss +0 -128
  207. data/vendor/assets/stylesheets/_progress.scss +0 -86
  208. data/vendor/assets/stylesheets/_reset.scss +0 -140
  209. data/vendor/assets/stylesheets/_sidebar.scss +0 -148
  210. data/vendor/assets/stylesheets/_slider.scss +0 -151
  211. data/vendor/assets/stylesheets/_spinner.scss +0 -572
  212. data/vendor/assets/stylesheets/_subheader.scss +0 -112
  213. data/vendor/assets/stylesheets/_swoggle.scss +0 -120
  214. data/vendor/assets/stylesheets/_table.scss +0 -210
  215. data/vendor/assets/stylesheets/_timepicker.scss +0 -77
  216. data/vendor/assets/stylesheets/_toolbar.scss +0 -130
  217. data/vendor/assets/stylesheets/_tooltip.scss +0 -105
  218. data/vendor/assets/stylesheets/_transition.scss +0 -11
  219. data/vendor/assets/stylesheets/_trunk.scss +0 -147
  220. data/vendor/assets/stylesheets/_typeahead.scss +0 -18
  221. data/vendor/assets/stylesheets/_typography.scss +0 -233
@@ -1,415 +0,0 @@
1
- (function() {
2
- var __slice = [].slice;
3
-
4
- (function($, window) {
5
- "use strict";
6
- var swoggle;
7
- swoggle = (function() {
8
- swoggle.prototype.defaults = {
9
- state: true,
10
- size: null,
11
- animate: true,
12
- disabled: false,
13
- readonly: false,
14
- onColor: "green",
15
- offColor: null,
16
- onText: "",
17
- offText: "",
18
- labelText: " "
19
- };
20
-
21
- swoggle.prototype.name = "swoggle";
22
-
23
- function swoggle(element, options) {
24
- if (options == null) {
25
- options = {};
26
- }
27
- this.$element = $(element);
28
- this.options = $.extend({}, this.defaults, options, {
29
- state: this.$element.is(":checked"),
30
- size: this.$element.data("size"),
31
- animate: this.$element.data("animate"),
32
- disabled: this.$element.is(":disabled"),
33
- readonly: this.$element.is("[readonly]"),
34
- onColor: this.$element.data("on-color"),
35
- offColor: this.$element.data("off-color"),
36
- onText: this.$element.data("on-text"),
37
- offText: this.$element.data("off-text"),
38
- labelText: this.$element.data("label-text")
39
- });
40
- this.$on = $("<span>", {
41
- "class": "" + this.name + "-handle-on " + this.name + "-" + this.options.onColor,
42
- html: this.options.onText
43
- });
44
- this.$off = $("<span>", {
45
- "class": "" + this.name + "-handle-off " + this.name + "-" + this.options.offColor,
46
- html: this.options.offText
47
- });
48
- this.$label = $("<label>", {
49
- "for": this.$element.attr("id"),
50
- html: this.options.labelText
51
- });
52
- this.$wrapper = $("<div>", {
53
- "class": (function(_this) {
54
- return function() {
55
- var classes;
56
- classes = ["" + _this.name];
57
- classes.push(_this.options.state ? "" + _this.name + "-on" : "" + _this.name + "-off");
58
- if (_this.options.size != null) {
59
- classes.push("" + _this.name + "-" + _this.options.size);
60
- }
61
- if (_this.options.onColor != null) {
62
- classes.push("" + _this.name + "-" + _this.options.onColor);
63
- }
64
- if (_this.options.animate) {
65
- classes.push("" + _this.name + "-animate");
66
- }
67
- if (_this.options.disabled) {
68
- classes.push("" + _this.name + "-disabled");
69
- }
70
- if (_this.options.readonly) {
71
- classes.push("" + _this.name + "-readonly");
72
- }
73
- if (_this.$element.attr("id")) {
74
- classes.push("" + _this.name + "-id-" + (_this.$element.attr("id")));
75
- }
76
- return classes.join(" ");
77
- };
78
- })(this)
79
- });
80
- this.$div = this.$element.wrap($("<div>")).parent();
81
- this.$wrapper = this.$div.wrap(this.$wrapper).parent();
82
- this.$element.before(this.$on).before(this.$label).before(this.$off);
83
- this._elementHandlers();
84
- this._handleHandlers();
85
- this._labelHandlers();
86
- this._formHandler();
87
- }
88
-
89
- swoggle.prototype._constructor = swoggle;
90
-
91
- swoggle.prototype.state = function(value, skip) {
92
- if (typeof value === "undefined") {
93
- return this.options.state;
94
- }
95
- if (this.options.disabled || this.options.readonly) {
96
- return this.$element;
97
- }
98
- value = !!value;
99
- this.$element.prop("checked", value).trigger("change.swoggle", skip);
100
- return this.$element;
101
- };
102
-
103
- swoggle.prototype.toggleState = function(skip) {
104
- if (this.options.disabled || this.options.readonly) {
105
- return this.$element;
106
- }
107
- return this.$element.prop("checked", !this.options.state).trigger("change.swoggle", skip);
108
- };
109
-
110
- swoggle.prototype.size = function(value) {
111
- if (typeof value === "undefined") {
112
- return this.options.size;
113
- }
114
- if (this.options.size != null) {
115
- this.$wrapper.removeClass("" + this.name + "-" + this.options.size);
116
- }
117
- this.$wrapper.addClass("" + this.name + "-" + value);
118
- this.options.size = value;
119
- return this.$element;
120
- };
121
-
122
- swoggle.prototype.animate = function(value) {
123
- if (typeof value === "undefined") {
124
- return this.options.animate;
125
- }
126
- value = !!value;
127
- this.$wrapper[value ? "addClass" : "removeClass"]("" + this.name + "-animate");
128
- this.options.animate = value;
129
- return this.$element;
130
- };
131
-
132
- swoggle.prototype.disabled = function(value) {
133
- if (typeof value === "undefined") {
134
- return this.options.disabled;
135
- }
136
- value = !!value;
137
- this.$wrapper[value ? "addClass" : "removeClass"]("" + this.name + "-disabled");
138
- this.$element.prop("disabled", value);
139
- this.options.disabled = value;
140
- return this.$element;
141
- };
142
-
143
- swoggle.prototype.toggleDisabled = function() {
144
- this.$element.prop("disabled", !this.options.disabled);
145
- this.$wrapper.toggleClass("" + this.name + "-disabled");
146
- this.options.disabled = !this.options.disabled;
147
- return this.$element;
148
- };
149
-
150
- swoggle.prototype.readonly = function(value) {
151
- if (typeof value === "undefined") {
152
- return this.options.readonly;
153
- }
154
- value = !!value;
155
- this.$wrapper[value ? "addClass" : "removeClass"]("" + this.name + "-readonly");
156
- this.$element.prop("readonly", value);
157
- this.options.readonly = value;
158
- return this.$element;
159
- };
160
-
161
- swoggle.prototype.toggleReadonly = function() {
162
- this.$element.prop("readonly", !this.options.readonly);
163
- this.$wrapper.toggleClass("" + this.name + "-readonly");
164
- this.options.readonly = !this.options.readonly;
165
- return this.$element;
166
- };
167
-
168
- swoggle.prototype.onColor = function(value) {
169
- var color;
170
- color = this.options.onColor;
171
- if (typeof value === "undefined") {
172
- return color;
173
- }
174
- if (color != null) {
175
- this.$on.removeClass("" + this.name + "-" + color);
176
- }
177
- this.$on.addClass("" + this.name + "-" + value);
178
- this.options.onColor = value;
179
- return this.$element;
180
- };
181
-
182
- swoggle.prototype.offColor = function(value) {
183
- var color;
184
- color = this.options.offColor;
185
- if (typeof value === "undefined") {
186
- return color;
187
- }
188
- if (color != null) {
189
- this.$off.removeClass("" + this.name + "-" + color);
190
- }
191
- this.$off.addClass("" + this.name + "-" + value);
192
- this.options.offColor = value;
193
- return this.$element;
194
- };
195
-
196
- swoggle.prototype.onText = function(value) {
197
- if (typeof value === "undefined") {
198
- return this.options.onText;
199
- }
200
- this.$on.html(value);
201
- this.options.onText = value;
202
- return this.$element;
203
- };
204
-
205
- swoggle.prototype.offText = function(value) {
206
- if (typeof value === "undefined") {
207
- return this.options.offText;
208
- }
209
- this.$off.html(value);
210
- this.options.offText = value;
211
- return this.$element;
212
- };
213
-
214
- swoggle.prototype.labelText = function(value) {
215
- if (typeof value === "undefined") {
216
- return this.options.labelText;
217
- }
218
- this.$label.html(value);
219
- this.options.labelText = value;
220
- return this.$element;
221
- };
222
-
223
- swoggle.prototype.destroy = function() {
224
- var $form;
225
- $form = this.$element.closest("form");
226
- if ($form.length) {
227
- $form.off("reset.swoggle").removeData("swoggle");
228
- }
229
- this.$div.children().not(this.$element).remove();
230
- this.$element.unwrap().unwrap().off(".swoggle").removeData("swoggle");
231
- return this.$element;
232
- };
233
-
234
- swoggle.prototype._elementHandlers = function() {
235
- return this.$element.on({
236
- "change.swoggle": (function(_this) {
237
- return function(e, skip) {
238
- var checked;
239
- e.preventDefault();
240
- e.stopPropagation();
241
- e.stopImmediatePropagation();
242
- checked = _this.$element.is(":checked");
243
- if (checked === _this.options.state) {
244
- return;
245
- }
246
- _this.options.state = checked;
247
- _this.$wrapper.removeClass(checked ? "" + _this.name + "-off" : "" + _this.name + "-on").addClass(checked ? "" + _this.name + "-on" : "" + _this.name + "-off");
248
- if (!skip) {
249
- if (_this.$element.is(":radio")) {
250
- $("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.swoggle", true);
251
- }
252
- return _this.$element.trigger("switchChange", {
253
- el: _this.$element,
254
- value: checked
255
- });
256
- }
257
- };
258
- })(this),
259
- "focus.swoggle": (function(_this) {
260
- return function(e) {
261
- e.preventDefault();
262
- e.stopPropagation();
263
- e.stopImmediatePropagation();
264
- return _this.$wrapper.addClass("" + _this.name + "-focused");
265
- };
266
- })(this),
267
- "blur.swoggle": (function(_this) {
268
- return function(e) {
269
- e.preventDefault();
270
- e.stopPropagation();
271
- e.stopImmediatePropagation();
272
- return _this.$wrapper.removeClass("" + _this.name + "-focused");
273
- };
274
- })(this),
275
- "keydown.swoggle": (function(_this) {
276
- return function(e) {
277
- if (!e.which || _this.options.disabled || _this.options.readonly) {
278
- return;
279
- }
280
- switch (e.which) {
281
- case 32:
282
- e.preventDefault();
283
- e.stopPropagation();
284
- e.stopImmediatePropagation();
285
- return _this.toggleState();
286
- case 37:
287
- e.preventDefault();
288
- e.stopPropagation();
289
- e.stopImmediatePropagation();
290
- return _this.state(false);
291
- case 39:
292
- e.preventDefault();
293
- e.stopPropagation();
294
- e.stopImmediatePropagation();
295
- return _this.state(true);
296
- }
297
- };
298
- })(this)
299
- });
300
- };
301
-
302
- swoggle.prototype._handleHandlers = function() {
303
- this.$on.on("click.swoggle", (function(_this) {
304
- return function(e) {
305
- _this.state(false);
306
- return _this.$element.trigger("focus.swoggle");
307
- };
308
- })(this));
309
- return this.$off.on("click.swoggle", (function(_this) {
310
- return function(e) {
311
- _this.state(true);
312
- return _this.$element.trigger("focus.swoggle");
313
- };
314
- })(this));
315
- };
316
-
317
- swoggle.prototype._labelHandlers = function() {
318
- return this.$label.on({
319
- "mousemove.swoggle": (function(_this) {
320
- return function(e) {
321
- var left, percent, right;
322
- if (!_this.drag) {
323
- return;
324
- }
325
- percent = ((e.pageX - _this.$wrapper.offset().left) / _this.$wrapper.width()) * 100;
326
- left = 25;
327
- right = 75;
328
- if (percent < left) {
329
- percent = left;
330
- } else if (percent > right) {
331
- percent = right;
332
- }
333
- _this.$div.css("margin-left", "" + (percent - right) + "%");
334
- return _this.$element.trigger("focus.swoggle");
335
- };
336
- })(this),
337
- "mousedown.swoggle": (function(_this) {
338
- return function(e) {
339
- if (_this.drag || _this.options.disabled || _this.options.readonly) {
340
- return;
341
- }
342
- _this.drag = true;
343
- if (_this.options.animate) {
344
- _this.$wrapper.removeClass("" + _this.name + "-animate");
345
- }
346
- return _this.$element.trigger("focus.swoggle");
347
- };
348
- })(this),
349
- "mouseup.swoggle": (function(_this) {
350
- return function(e) {
351
- if (!_this.drag) {
352
- return;
353
- }
354
- _this.drag = false;
355
- _this.$element.prop("checked", parseInt(_this.$div.css("margin-left"), 10) > -25).trigger("change.swoggle");
356
- _this.$div.css("margin-left", "");
357
- if (_this.options.animate) {
358
- return _this.$wrapper.addClass("" + _this.name + "-animate");
359
- }
360
- };
361
- })(this),
362
- "click.swoggle": (function(_this) {
363
- return function(e) {
364
- e.preventDefault();
365
- e.stopImmediatePropagation();
366
- _this.toggleState();
367
- return _this.$element.trigger("focus.swoggle");
368
- };
369
- })(this)
370
- });
371
- };
372
-
373
- swoggle.prototype._formHandler = function() {
374
- var $form;
375
- $form = this.$element.closest("form");
376
- if ($form.data("swoggle")) {
377
- return;
378
- }
379
- return $form.on("reset.swoggle", function() {
380
- return window.setTimeout(function() {
381
- return $form.find("input").filter(function() {
382
- return $(this).data("swoggle");
383
- }).each(function() {
384
- return $(this).swoggle("state", false);
385
- });
386
- }, 1);
387
- }).data("swoggle", true);
388
- };
389
-
390
- return swoggle;
391
-
392
- })();
393
- $.fn.extend({
394
- swoggle: function() {
395
- var args, option, ret;
396
- option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
397
- ret = this;
398
- this.each(function() {
399
- var $this, data;
400
- $this = $(this);
401
- data = $this.data("swoggle");
402
- if (!data) {
403
- $this.data("swoggle", data = new swoggle(this, option));
404
- }
405
- if (typeof option === "string") {
406
- return ret = data[option].apply(data, args);
407
- }
408
- });
409
- return ret;
410
- }
411
- });
412
- return $.fn.swoggle.Constructor = swoggle;
413
- })(window.jQuery, window);
414
-
415
- }).call(this);
@@ -1,146 +0,0 @@
1
- +function ($) {
2
- 'use strict';
3
-
4
- // TAB CLASS DEFINITION
5
- // ====================
6
-
7
- var Tab = function (element) {
8
- // jscs:disable requireDollarBeforejQueryAssignment
9
- this.element = $(element)
10
- // jscs:enable requireDollarBeforejQueryAssignment
11
- }
12
-
13
- Tab.VERSION = '3.3.6'
14
-
15
- Tab.TRANSITION_DURATION = 150
16
-
17
- Tab.prototype.show = function () {
18
- var $this = this.element
19
- var $ul = $this.closest('ul:not(.dropdown-menu)')
20
- var selector = $this.data('target')
21
-
22
- if (!selector) {
23
- selector = $this.attr('href')
24
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
25
- }
26
-
27
- if ($this.parent('li').hasClass('active')) return
28
-
29
- var $previous = $ul.find('.active:last a')
30
- var hideEvent = $.Event('hide.bs.tab', {
31
- relatedTarget: $this[0]
32
- })
33
- var showEvent = $.Event('show.bs.tab', {
34
- relatedTarget: $previous[0]
35
- })
36
-
37
- $previous.trigger(hideEvent)
38
- $this.trigger(showEvent)
39
-
40
- if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
41
-
42
- var $target = $(selector)
43
-
44
- this.activate($this.closest('li'), $ul)
45
- this.activate($target, $target.parent(), function () {
46
- $previous.trigger({
47
- type: 'hidden.bs.tab',
48
- relatedTarget: $this[0]
49
- })
50
- $this.trigger({
51
- type: 'shown.bs.tab',
52
- relatedTarget: $previous[0]
53
- })
54
- })
55
- }
56
-
57
- Tab.prototype.activate = function (element, container, callback) {
58
- var $active = container.find('> .active')
59
- var transition = callback
60
- && $.support.transition
61
- && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
62
-
63
- function next() {
64
- $active
65
- .removeClass('active')
66
- .find('> .dropdown-menu > .active')
67
- .removeClass('active')
68
- .end()
69
- .find('[data-toggle="tab"]')
70
- .attr('aria-expanded', false)
71
-
72
- element
73
- .addClass('active')
74
- .find('[data-toggle="tab"]')
75
- .attr('aria-expanded', true)
76
-
77
- if (transition) {
78
- element[0].offsetWidth // reflow for transition
79
- element.addClass('in')
80
- } else {
81
- element.removeClass('fade')
82
- }
83
-
84
- if (element.parent('.dropdown-menu').length) {
85
- element
86
- .closest('li.dropdown')
87
- .addClass('active')
88
- .end()
89
- .find('[data-toggle="tab"]')
90
- .attr('aria-expanded', true)
91
- }
92
-
93
- callback && callback()
94
- }
95
-
96
- $active.length && transition ?
97
- $active
98
- .one('bsTransitionEnd', next)
99
- .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
100
- next()
101
-
102
- $active.removeClass('in')
103
- }
104
-
105
-
106
- // TAB PLUGIN DEFINITION
107
- // =====================
108
-
109
- function Plugin(option) {
110
- return this.each(function () {
111
- var $this = $(this)
112
- var data = $this.data('bs.tab')
113
-
114
- if (!data) $this.data('bs.tab', (data = new Tab(this)))
115
- if (typeof option == 'string') data[option]()
116
- })
117
- }
118
-
119
- var old = $.fn.tab
120
-
121
- $.fn.tab = Plugin
122
- $.fn.tab.Constructor = Tab
123
-
124
-
125
- // TAB NO CONFLICT
126
- // ===============
127
-
128
- $.fn.tab.noConflict = function () {
129
- $.fn.tab = old
130
- return this
131
- }
132
-
133
-
134
- // TAB DATA-API
135
- // ============
136
-
137
- var clickHandler = function (e) {
138
- e.preventDefault()
139
- Plugin.call($(this), 'show')
140
- }
141
-
142
- $(document)
143
- .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
144
- .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
145
-
146
- }(jQuery);