active_frontend 1.0.11 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/active_frontend/version.rb +1 -1
  3. data/vendor/assets/javascripts/affix.js +2 -2
  4. data/vendor/assets/javascripts/alert.js +1 -1
  5. data/vendor/assets/javascripts/button.js +1 -1
  6. data/vendor/assets/javascripts/carousel.js +1 -1
  7. data/vendor/assets/javascripts/collapse.js +2 -2
  8. data/vendor/assets/javascripts/dropdown.js +8 -4
  9. data/vendor/assets/javascripts/loader.js +361 -0
  10. data/vendor/assets/javascripts/map.js +8 -0
  11. data/vendor/assets/javascripts/popover.js +2 -2
  12. data/vendor/assets/javascripts/scrollspy.js +2 -2
  13. data/vendor/assets/javascripts/tab.js +1 -1
  14. data/vendor/assets/javascripts/tooltip.js +3 -3
  15. data/vendor/assets/stylesheets/affix.scss +4 -1
  16. data/vendor/assets/stylesheets/alert.scss +23 -8
  17. data/vendor/assets/stylesheets/animation.scss +185 -185
  18. data/vendor/assets/stylesheets/aside.scss +13 -13
  19. data/vendor/assets/stylesheets/breadcrumb.scss +2 -2
  20. data/vendor/assets/stylesheets/button.scss +102 -239
  21. data/vendor/assets/stylesheets/canvas.scss +77 -0
  22. data/vendor/assets/stylesheets/carousel.scss +3 -3
  23. data/vendor/assets/stylesheets/code.scss +48 -54
  24. data/vendor/assets/stylesheets/collapse.scss +2 -2
  25. data/vendor/assets/stylesheets/datepicker.scss +17 -17
  26. data/vendor/assets/stylesheets/dropdown.scss +11 -11
  27. data/vendor/assets/stylesheets/footer.scss +88 -20
  28. data/vendor/assets/stylesheets/form.scss +25 -59
  29. data/vendor/assets/stylesheets/grid.scss +137 -168
  30. data/vendor/assets/stylesheets/header.scss +61 -98
  31. data/vendor/assets/stylesheets/image.scss +24 -269
  32. data/vendor/assets/stylesheets/label_and_badge.scss +50 -49
  33. data/vendor/assets/stylesheets/link.scss +11 -7
  34. data/vendor/assets/stylesheets/loader.scss +56 -0
  35. data/vendor/assets/stylesheets/map.scss +1 -1
  36. data/vendor/assets/stylesheets/modal.scss +13 -13
  37. data/vendor/assets/stylesheets/nav_and_tab.scss +12 -12
  38. data/vendor/assets/stylesheets/pagination.scss +3 -3
  39. data/vendor/assets/stylesheets/panel.scss +2 -2
  40. data/vendor/assets/stylesheets/placeholder.scss +1 -1
  41. data/vendor/assets/stylesheets/popover.scss +12 -12
  42. data/vendor/assets/stylesheets/progress.scss +5 -5
  43. data/vendor/assets/stylesheets/reset.scss +10 -9
  44. data/vendor/assets/stylesheets/sidebar.scss +65 -0
  45. data/vendor/assets/stylesheets/spinner.scss +100 -112
  46. data/vendor/assets/stylesheets/swoggle.scss +29 -26
  47. data/vendor/assets/stylesheets/table.scss +7 -7
  48. data/vendor/assets/stylesheets/timepicker.scss +10 -10
  49. data/vendor/assets/stylesheets/tooltip.scss +9 -9
  50. data/vendor/assets/stylesheets/transition.scss +1 -1
  51. data/vendor/assets/stylesheets/trunk.scss +19 -24
  52. data/vendor/assets/stylesheets/typeahead.scss +1 -1
  53. data/vendor/assets/stylesheets/typography.scss +7 -7
  54. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09800b819188c747044eb5a59c0025cbf6b0a0da
4
- data.tar.gz: 2e35a8ba61ebd6d6366047b1a301b43e0210a093
3
+ metadata.gz: 45e047bfc3f81e23b84a087443b2358e59fd7324
4
+ data.tar.gz: a0bfcb4d7533f006a142cf9b75144e9fffb55cf3
5
5
  SHA512:
6
- metadata.gz: 34afca08741b909ed18fca8364dc5391bdbbe13d31dea252ec797074fed82206ad39352ee2eff06266493ff677d05e79366911a4f7bc158e955ecf174ac993e6
7
- data.tar.gz: 87560c51097c0e38e36a81c4fc5d838b67e969cae796b2dfbc0013d90d46569e86cbfa3ef455fcf86e641e8390174be3f5a9518b9366cb388486cf71898a3579
6
+ metadata.gz: e713575f895c63ec2dec54ff75824636694e7dd3000453830b037bed0af7f2b4be27eff0ffce84bdd6a84aacd97ca82b925d75ce8d261434c6872ff468cfc09e
7
+ data.tar.gz: f0038146d70ff7a446b0952d27f8ccfaf943427c0edcb6eeb3a772f115a91c2320e06725ee912178ef8307a5201cfdbbc8179e59e91a4b828d0769af0d885acc
@@ -1,3 +1,3 @@
1
1
  module ActiveFrontend
2
- VERSION = "1.0.11"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -19,7 +19,7 @@
19
19
  this.checkPosition()
20
20
  }
21
21
 
22
- Affix.VERSION = '3.3.2'
22
+ Affix.VERSION = '3.3.4'
23
23
 
24
24
  Affix.RESET = 'affix affix-top affix-bottom'
25
25
 
@@ -69,7 +69,7 @@
69
69
  var offset = this.options.offset
70
70
  var offsetTop = offset.top
71
71
  var offsetBottom = offset.bottom
72
- var scrollHeight = $('body').height()
72
+ var scrollHeight = $(document.body).height()
73
73
 
74
74
  if (typeof offset != 'object') offsetBottom = offsetTop = offset
75
75
  if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
@@ -9,7 +9,7 @@
9
9
  $(el).on('click', dismiss, this.close)
10
10
  }
11
11
 
12
- Alert.VERSION = '3.3.2'
12
+ Alert.VERSION = '3.3.4'
13
13
 
14
14
  Alert.TRANSITION_DURATION = 150
15
15
 
@@ -10,7 +10,7 @@
10
10
  this.isLoading = false
11
11
  }
12
12
 
13
- Button.VERSION = '3.3.2'
13
+ Button.VERSION = '3.3.4'
14
14
 
15
15
  Button.DEFAULTS = {
16
16
  loadingText: 'loading...'
@@ -21,7 +21,7 @@
21
21
  .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
22
22
  }
23
23
 
24
- Carousel.VERSION = '3.3.2'
24
+ Carousel.VERSION = '3.3.4'
25
25
 
26
26
  Carousel.TRANSITION_DURATION = 600
27
27
 
@@ -20,7 +20,7 @@
20
20
  if (this.options.toggle) this.toggle()
21
21
  }
22
22
 
23
- Collapse.VERSION = '3.3.2'
23
+ Collapse.VERSION = '3.3.4'
24
24
 
25
25
  Collapse.TRANSITION_DURATION = 350
26
26
 
@@ -163,7 +163,7 @@
163
163
  var data = $this.data('bs.collapse')
164
164
  var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
165
165
 
166
- if (!data && options.toggle && option == 'show') options.toggle = false
166
+ if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
167
167
  if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
168
168
  if (typeof option == 'string') data[option]()
169
169
  })
@@ -10,7 +10,7 @@
10
10
  $(element).on('click.bs.dropdown', this.toggle)
11
11
  }
12
12
 
13
- Dropdown.VERSION = '3.3.2'
13
+ Dropdown.VERSION = '3.3.4'
14
14
 
15
15
  Dropdown.prototype.toggle = function (e) {
16
16
  var $this = $(this)
@@ -25,7 +25,10 @@
25
25
  if (!isActive) {
26
26
  if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
27
27
  // if mobile we use a backdrop because click events don't delegate
28
- $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
28
+ $(document.createElement('div'))
29
+ .addClass('dropdown-backdrop')
30
+ .insertAfter($(this))
31
+ .on('click', clearMenus)
29
32
  }
30
33
 
31
34
  var relatedTarget = { relatedTarget: this }
@@ -87,6 +90,8 @@
87
90
 
88
91
  if (!$parent.hasClass('open')) return
89
92
 
93
+ if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
94
+
90
95
  $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
91
96
 
92
97
  if (e.isDefaultPrevented()) return
@@ -146,7 +151,6 @@
146
151
  .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
147
152
  .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
148
153
  .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
149
- .on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown)
150
- .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
154
+ .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
151
155
 
152
156
  }(jQuery);
@@ -0,0 +1,361 @@
1
+ ;(function(root, factory) {
2
+
3
+ if (typeof define === 'function' && define.amd) {
4
+ define(factory);
5
+ } else if (typeof exports === 'object') {
6
+ module.exports = factory();
7
+ } else {
8
+ root.Loader = factory();
9
+ }
10
+
11
+ })(this, function() {
12
+ var Loader = {};
13
+
14
+ Loader.version = '0.1.6';
15
+
16
+ var Settings = Loader.settings = {
17
+ minimum: 0.08,
18
+ easing: 'ease',
19
+ positionUsing: '',
20
+ speed: 200,
21
+ trickle: true,
22
+ trickleRate: 0.02,
23
+ trickleSpeed: 800,
24
+ showSpinner: true,
25
+ barSelector: '[role="bar"]',
26
+ spinnerSelector: '[role="spinner"]',
27
+ parent: 'body',
28
+ template: '<div class="loader-bar" role="bar"><div class="loader-peg"></div></div><div class="loader-spinner" role="spinner"><div class="loader-spinner-icon"></div></div>'
29
+ };
30
+
31
+ Loader.configure = function(options) {
32
+ var key, value;
33
+ for (key in options) {
34
+ value = options[key];
35
+ if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
36
+ }
37
+
38
+ return this;
39
+ };
40
+
41
+ Loader.status = null;
42
+
43
+ Loader.set = function(n) {
44
+ var started = Loader.isStarted();
45
+
46
+ n = clamp(n, Settings.minimum, 1);
47
+ Loader.status = (n === 1 ? null : n);
48
+
49
+ var progress = Loader.render(!started),
50
+ bar = progress.querySelector(Settings.barSelector),
51
+ speed = Settings.speed,
52
+ ease = Settings.easing;
53
+
54
+ progress.offsetWidth;
55
+
56
+ queue(function(next) {
57
+ if (Settings.positionUsing === '') Settings.positionUsing = Loader.getPositioningCSS();
58
+
59
+ css(bar, barPositionCSS(n, speed, ease));
60
+
61
+ if (n === 1) {
62
+ css(progress, {
63
+ transition: 'none',
64
+ opacity: 1
65
+ });
66
+ progress.offsetWidth;
67
+
68
+ setTimeout(function() {
69
+ css(progress, {
70
+ transition: 'all ' + speed + 'ms linear',
71
+ opacity: 0
72
+ });
73
+ setTimeout(function() {
74
+ Loader.remove();
75
+ next();
76
+ }, speed);
77
+ }, speed);
78
+ } else {
79
+ setTimeout(next, speed);
80
+ }
81
+ });
82
+
83
+ return this;
84
+ };
85
+
86
+ Loader.isStarted = function() {
87
+ return typeof Loader.status === 'number';
88
+ };
89
+
90
+ Loader.start = function() {
91
+ if (!Loader.status) Loader.set(0);
92
+
93
+ var work = function() {
94
+ setTimeout(function() {
95
+ if (!Loader.status) return;
96
+ Loader.trickle();
97
+ work();
98
+ }, Settings.trickleSpeed);
99
+ };
100
+
101
+ if (Settings.trickle) work();
102
+
103
+ return this;
104
+ };
105
+
106
+ Loader.done = function(force) {
107
+ if (!force && !Loader.status) return this;
108
+
109
+ return Loader.inc(0.3 + 0.5 * Math.random()).set(1);
110
+ };
111
+
112
+ Loader.inc = function(amount) {
113
+ var n = Loader.status;
114
+
115
+ if (!n) {
116
+ return Loader.start();
117
+ } else {
118
+ if (typeof amount !== 'number') {
119
+ amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
120
+ }
121
+
122
+ n = clamp(n + amount, 0, 0.994);
123
+ return Loader.set(n);
124
+ }
125
+ };
126
+
127
+ Loader.trickle = function() {
128
+ return Loader.inc(Math.random() * Settings.trickleRate);
129
+ };
130
+
131
+ (function() {
132
+ var initial = 0, current = 0;
133
+
134
+ Loader.promise = function($promise) {
135
+ if (!$promise || $promise.state() == "resolved") {
136
+ return this;
137
+ }
138
+
139
+ if (current == 0) {
140
+ Loader.start();
141
+ }
142
+
143
+ initial++;
144
+ current++;
145
+
146
+ $promise.always(function() {
147
+ current--;
148
+ if (current == 0) {
149
+ initial = 0;
150
+ Loader.done();
151
+ } else {
152
+ Loader.set((initial - current) / initial);
153
+ }
154
+ });
155
+
156
+ return this;
157
+ };
158
+
159
+ })();
160
+
161
+ Loader.render = function(fromStart) {
162
+ if (Loader.isRendered()) return document.getElementById('loader');
163
+
164
+ addClass(document.documentElement, 'loader-busy');
165
+
166
+ var progress = document.createElement('div');
167
+ progress.id = 'loader';
168
+ progress.innerHTML = Settings.template;
169
+
170
+ var bar = progress.querySelector(Settings.barSelector),
171
+ perc = fromStart ? '-100' : toBarPerc(Loader.status || 0),
172
+ parent = document.querySelector(Settings.parent),
173
+ spinner;
174
+
175
+ css(bar, {
176
+ transition: 'all 0 linear',
177
+ transform: 'translate3d(' + perc + '%,0,0)'
178
+ });
179
+
180
+ if (!Settings.showSpinner) {
181
+ spinner = progress.querySelector(Settings.spinnerSelector);
182
+ spinner && removeElement(spinner);
183
+ }
184
+
185
+ if (parent != document.body) {
186
+ addClass(parent, 'loader-custom-parent');
187
+ }
188
+
189
+ parent.appendChild(progress);
190
+ return progress;
191
+ };
192
+
193
+ Loader.remove = function() {
194
+ removeClass(document.documentElement, 'loader-busy');
195
+ removeClass(document.querySelector(Settings.parent), 'loader-custom-parent')
196
+ var progress = document.getElementById('loader');
197
+ progress && removeElement(progress);
198
+ };
199
+
200
+ Loader.isRendered = function() {
201
+ return !!document.getElementById('loader');
202
+ };
203
+
204
+ Loader.getPositioningCSS = function() {
205
+ var bodyStyle = document.body.style;
206
+
207
+ var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
208
+ ('MozTransform' in bodyStyle) ? 'Moz' :
209
+ ('msTransform' in bodyStyle) ? 'ms' :
210
+ ('OTransform' in bodyStyle) ? 'O' : '';
211
+
212
+ if (vendorPrefix + 'Perspective' in bodyStyle) {
213
+ return 'translate3d';
214
+ } else if (vendorPrefix + 'Transform' in bodyStyle) {
215
+ return 'translate';
216
+ } else {
217
+ return 'margin';
218
+ }
219
+ };
220
+
221
+ function clamp(n, min, max) {
222
+ if (n < min) return min;
223
+ if (n > max) return max;
224
+ return n;
225
+ }
226
+
227
+ function toBarPerc(n) {
228
+ return (-1 + n) * 100;
229
+ }
230
+
231
+ function barPositionCSS(n, speed, ease) {
232
+ var barCSS;
233
+
234
+ if (Settings.positionUsing === 'translate3d') {
235
+ barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
236
+ } else if (Settings.positionUsing === 'translate') {
237
+ barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
238
+ } else {
239
+ barCSS = { 'margin-left': toBarPerc(n)+'%' };
240
+ }
241
+
242
+ barCSS.transition = 'all '+speed+'ms '+ease;
243
+
244
+ return barCSS;
245
+ }
246
+
247
+ var queue = (function() {
248
+ var pending = [];
249
+
250
+ function next() {
251
+ var fn = pending.shift();
252
+ if (fn) {
253
+ fn(next);
254
+ }
255
+ }
256
+
257
+ return function(fn) {
258
+ pending.push(fn);
259
+ if (pending.length == 1) next();
260
+ };
261
+ })();
262
+
263
+ var css = (function() {
264
+ var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
265
+ cssProps = {};
266
+
267
+ function camelCase(string) {
268
+ return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
269
+ return letter.toUpperCase();
270
+ });
271
+ }
272
+
273
+ function getVendorProp(name) {
274
+ var style = document.body.style;
275
+ if (name in style) return name;
276
+
277
+ var i = cssPrefixes.length,
278
+ capName = name.charAt(0).toUpperCase() + name.slice(1),
279
+ vendorName;
280
+ while (i--) {
281
+ vendorName = cssPrefixes[i] + capName;
282
+ if (vendorName in style) return vendorName;
283
+ }
284
+
285
+ return name;
286
+ }
287
+
288
+ function getStyleProp(name) {
289
+ name = camelCase(name);
290
+ return cssProps[name] || (cssProps[name] = getVendorProp(name));
291
+ }
292
+
293
+ function applyCss(element, prop, value) {
294
+ prop = getStyleProp(prop);
295
+ element.style[prop] = value;
296
+ }
297
+
298
+ return function(element, properties) {
299
+ var args = arguments,
300
+ prop,
301
+ value;
302
+
303
+ if (args.length == 2) {
304
+ for (prop in properties) {
305
+ value = properties[prop];
306
+ if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
307
+ }
308
+ } else {
309
+ applyCss(element, args[1], args[2]);
310
+ }
311
+ }
312
+ })();
313
+
314
+ function hasClass(element, name) {
315
+ var list = typeof element == 'string' ? element : classList(element);
316
+ return list.indexOf(' ' + name + ' ') >= 0;
317
+ }
318
+
319
+ function addClass(element, name) {
320
+ var oldList = classList(element),
321
+ newList = oldList + name;
322
+
323
+ if (hasClass(oldList, name)) return;
324
+
325
+ element.className = newList.substring(1);
326
+ }
327
+
328
+ function removeClass(element, name) {
329
+ var oldList = classList(element),
330
+ newList;
331
+
332
+ if (!hasClass(element, name)) return;
333
+
334
+ newList = oldList.replace(' ' + name + ' ', ' ');
335
+
336
+ element.className = newList.substring(1, newList.length - 1);
337
+ }
338
+ function classList(element) {
339
+ return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
340
+ }
341
+
342
+ function removeElement(element) {
343
+ element && element.parentNode && element.parentNode.removeChild(element);
344
+ }
345
+
346
+ return Loader;
347
+ });
348
+
349
+ jQuery(function() {
350
+ jQuery(document).on('ajaxStart', function() { Loader.start(); });
351
+ jQuery(document).on('ajaxStop', function() { Loader.done(); });
352
+ });
353
+
354
+ $(function() {
355
+ $(document).on('page:fetch', function() { Loader.start(); });
356
+ $(document).on('page:receive', function() { Loader.set(0.7); });
357
+ $(document).on('page:change', function() { Loader.done(); });
358
+ $(document).on('page:restore', function() { Loader.remove(); });
359
+ $(document).on('pjax:send', function() { Loader.start(); });
360
+ $(document).on('pjax:complete', function() { Loader.done(); });
361
+ });