uikit-sass-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/CHANGELOG.md +5 -0
  4. data/LICENSE.md +155 -0
  5. data/README.md +78 -0
  6. data/lib/uikit-sass-rails.rb +1 -0
  7. data/lib/uikit/sass/rails.rb +2 -0
  8. data/lib/uikit/sass/rails/engine.rb +12 -0
  9. data/lib/uikit/sass/rails/version.rb +7 -0
  10. data/uikit-sass-rails.gemspec +24 -0
  11. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  12. data/vendor/assets/fonts/fontawesome-webfont.svg +504 -0
  13. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  14. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  15. data/vendor/assets/javascripts/uikit.js +14 -0
  16. data/vendor/assets/javascripts/uikit/addons/autocomplete.js +306 -0
  17. data/vendor/assets/javascripts/uikit/addons/datepicker.js +365 -0
  18. data/vendor/assets/javascripts/uikit/addons/form-password.js +62 -0
  19. data/vendor/assets/javascripts/uikit/addons/form-select.js +62 -0
  20. data/vendor/assets/javascripts/uikit/addons/htmleditor.js +594 -0
  21. data/vendor/assets/javascripts/uikit/addons/nestable.js +574 -0
  22. data/vendor/assets/javascripts/uikit/addons/notify.js +177 -0
  23. data/vendor/assets/javascripts/uikit/addons/pagination.js +146 -0
  24. data/vendor/assets/javascripts/uikit/addons/search.js +90 -0
  25. data/vendor/assets/javascripts/uikit/addons/sortable.js +494 -0
  26. data/vendor/assets/javascripts/uikit/addons/sticky.js +130 -0
  27. data/vendor/assets/javascripts/uikit/addons/timepicker.js +163 -0
  28. data/vendor/assets/javascripts/uikit/addons/upload.js +239 -0
  29. data/vendor/assets/javascripts/uikit/uikit.js +2573 -0
  30. data/vendor/assets/stylesheets/extra/font-awesome.scss +16 -0
  31. data/vendor/assets/stylesheets/uikit.scss +5 -0
  32. data/vendor/assets/stylesheets/uikit/addons/uikit.addons.scss +1326 -0
  33. data/vendor/assets/stylesheets/uikit/addons/uikit.almost-flat.addons.scss +1423 -0
  34. data/vendor/assets/stylesheets/uikit/addons/uikit.gradient.addons.scss +1445 -0
  35. data/vendor/assets/stylesheets/uikit/almost-flat.scss +5 -0
  36. data/vendor/assets/stylesheets/uikit/gradient.scss +5 -0
  37. data/vendor/assets/stylesheets/uikit/uikit.almost-flat.scss +8207 -0
  38. data/vendor/assets/stylesheets/uikit/uikit.gradient.scss +8264 -0
  39. data/vendor/assets/stylesheets/uikit/uikit.scss +7874 -0
  40. metadata +100 -0
@@ -0,0 +1,574 @@
1
+ /*! UIkit 2.8.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+
3
+ /*
4
+ * Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
5
+ */
6
+ (function(addon) {
7
+
8
+ var component;
9
+
10
+ if (jQuery && jQuery.UIkit) {
11
+ component = addon(jQuery, jQuery.UIkit);
12
+ }
13
+
14
+ if (typeof define == "function" && define.amd) {
15
+ define("uikit-nestable", ["uikit"], function(){
16
+ return component || addon(jQuery, jQuery.UIkit);
17
+ });
18
+ }
19
+
20
+ })(function($, UI) {
21
+
22
+ var hasTouch = 'ontouchstart' in window,
23
+ html = $("html"),
24
+ touchedlists = [],
25
+ $win = $(window);
26
+
27
+ /**
28
+ * Detect CSS pointer-events property
29
+ * events are normally disabled on the dragging element to avoid conflicts
30
+ * https://github.com/ausi/Feature-detection-technique-for-pointer-events/blob/master/modernizr-pointerevents.js
31
+ */
32
+ var hasPointerEvents = (function() {
33
+
34
+ var el = document.createElement('div'), docEl = document.documentElement;
35
+
36
+ if (!('pointerEvents' in el.style)) {
37
+ return false;
38
+ }
39
+
40
+ el.style.pointerEvents = 'auto';
41
+ el.style.pointerEvents = 'x';
42
+
43
+ docEl.appendChild(el);
44
+
45
+ var supports = window.getComputedStyle && window.getComputedStyle(el, '').pointerEvents === 'auto';
46
+
47
+ docEl.removeChild(el);
48
+
49
+ return !!supports;
50
+ })();
51
+
52
+ var eStart = hasTouch ? 'touchstart' : 'mousedown',
53
+ eMove = hasTouch ? 'touchmove' : 'mousemove',
54
+ eEnd = hasTouch ? 'touchend' : 'mouseup',
55
+ eCancel = hasTouch ? 'touchcancel' : 'mouseup';
56
+
57
+
58
+ UI.component('nestable', {
59
+
60
+ defaults: {
61
+ prefix : 'uk',
62
+ listNodeName : 'ul',
63
+ itemNodeName : 'li',
64
+ listBaseClass : '{prefix}-nestable',
65
+ listClass : '{prefix}-nestable-list',
66
+ listitemClass : '{prefix}-nestable-list-item',
67
+ itemClass : '{prefix}-nestable-item',
68
+ dragClass : '{prefix}-nestable-list-dragged',
69
+ movingClass : '{prefix}-nestable-moving',
70
+ handleClass : '{prefix}-nestable-handle',
71
+ collapsedClass : '{prefix}-collapsed',
72
+ placeClass : '{prefix}-nestable-placeholder',
73
+ noDragClass : '{prefix}-nestable-nodrag',
74
+ emptyClass : '{prefix}-nestable-empty',
75
+ group : 0,
76
+ maxDepth : 10,
77
+ threshold : 20
78
+ },
79
+
80
+ init: function()
81
+ {
82
+ var $this = this;
83
+
84
+ Object.keys(this.options).forEach(function(key){
85
+
86
+ if(String($this.options[key]).indexOf('{prefix}')!=-1) {
87
+ $this.options[key] = $this.options[key].replace('{prefix}', $this.options.prefix);
88
+ }
89
+ });
90
+
91
+ this.tplempty = '<div class="' + this.options.emptyClass + '"/>';
92
+
93
+ this.find(">"+this.options.itemNodeName).addClass(this.options.listitemClass)
94
+ .end()
95
+ .find("ul:not(.ignore-list)").addClass(this.options.listClass)
96
+ .find(">li").addClass(this.options.listitemClass);
97
+
98
+ if (!this.element.children(this.options.itemNodeName).length) {
99
+ this.element.append(this.tplempty);
100
+ }
101
+
102
+ this.element.data("nestable-id", "ID"+(new Date().getTime())+"RAND"+(Math.ceil(Math.random() *100000)));
103
+ this.reset();
104
+ this.element.data('nestable-group', this.options.group);
105
+ this.placeEl = $('<div class="' + this.options.placeClass + '"/>');
106
+
107
+ this.find(this.options.itemNodeName).each(function() {
108
+ $this.setParent($(this));
109
+ });
110
+
111
+ this.on('click', '[data-nestable-action]', function(e) {
112
+
113
+ if ($this.dragEl || (!hasTouch && e.button !== 0)) {
114
+ return;
115
+ }
116
+
117
+ e.preventDefault();
118
+
119
+ var target = $(e.currentTarget),
120
+ action = target.data('nestableAction'),
121
+ item = target.closest($this.options.itemNodeName);
122
+ if (action === 'collapse') {
123
+ $this.collapseItem(item);
124
+ }
125
+ if (action === 'expand') {
126
+ $this.expandItem(item);
127
+ }
128
+ if (action === 'toggle') {
129
+ $this.toggleItem(item);
130
+ }
131
+ });
132
+
133
+ var onStartEvent = function(e) {
134
+
135
+ var handle = $(e.target);
136
+
137
+ if (!handle.hasClass($this.options.handleClass)) {
138
+ if (handle.closest('.' + $this.options.noDragClass).length) {
139
+ return;
140
+ }
141
+ handle = handle.closest('.' + $this.options.handleClass);
142
+ }
143
+ if (!handle.length || $this.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches.length !== 1)) {
144
+ return;
145
+ }
146
+ e.preventDefault();
147
+ $this.dragStart(hasTouch ? e.touches[0] : e);
148
+ $this.trigger('nestable-start', [$this]);
149
+ };
150
+
151
+ var onMoveEvent = function(e) {
152
+ if ($this.dragEl) {
153
+ e.preventDefault();
154
+ $this.dragMove(hasTouch ? e.touches[0] : e);
155
+ $this.trigger('nestable-move', [$this]);
156
+ }
157
+ };
158
+
159
+ var onEndEvent = function(e) {
160
+ if ($this.dragEl) {
161
+ e.preventDefault();
162
+ $this.dragStop(hasTouch ? e.touches[0] : e);
163
+ $this.trigger('nestable-stop', [$this]);
164
+ }
165
+ };
166
+
167
+ if (hasTouch) {
168
+ this.element[0].addEventListener(eStart, onStartEvent, false);
169
+ window.addEventListener(eMove, onMoveEvent, false);
170
+ window.addEventListener(eEnd, onEndEvent, false);
171
+ window.addEventListener(eCancel, onEndEvent, false);
172
+ } else {
173
+ this.on(eStart, onStartEvent);
174
+ $win.on(eMove, onMoveEvent);
175
+ $win.on(eEnd, onEndEvent);
176
+ }
177
+
178
+ },
179
+
180
+ serialize: function() {
181
+
182
+ var data,
183
+ depth = 0,
184
+ list = this;
185
+ step = function(level, depth) {
186
+
187
+ var array = [ ], items = level.children(list.options.itemNodeName);
188
+
189
+ items.each(function() {
190
+
191
+ var li = $(this),
192
+ item = $.extend({}, li.data()),
193
+ sub = li.children(list.options.listNodeName);
194
+
195
+ if (sub.length) {
196
+ item.children = step(sub, depth + 1);
197
+ }
198
+ array.push(item);
199
+ });
200
+ return array;
201
+ };
202
+
203
+ data = step(list.element, depth);
204
+
205
+ return data;
206
+ },
207
+
208
+ list: function(options) {
209
+
210
+ var data = [],
211
+ list = this,
212
+ depth = 0,
213
+ options = $.extend({}, list.options, options),
214
+ step = function(level, depth, parent) {
215
+
216
+ var items = level.children(options.itemNodeName);
217
+
218
+ items.each(function(index) {
219
+ var li = $(this),
220
+ item = $.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
221
+ sub = li.children(options.listNodeName);
222
+
223
+ data.push(item);
224
+
225
+ if (sub.length) {
226
+ step(sub, depth + 1, li.data(options.idProperty || 'id'));
227
+ }
228
+ });
229
+ };
230
+
231
+ step(list.element, depth);
232
+
233
+ return data;
234
+ },
235
+
236
+ reset: function() {
237
+
238
+ this.mouse = {
239
+ offsetX : 0,
240
+ offsetY : 0,
241
+ startX : 0,
242
+ startY : 0,
243
+ lastX : 0,
244
+ lastY : 0,
245
+ nowX : 0,
246
+ nowY : 0,
247
+ distX : 0,
248
+ distY : 0,
249
+ dirAx : 0,
250
+ dirX : 0,
251
+ dirY : 0,
252
+ lastDirX : 0,
253
+ lastDirY : 0,
254
+ distAxX : 0,
255
+ distAxY : 0
256
+ };
257
+ this.moving = false;
258
+ this.dragEl = null;
259
+ this.dragRootEl = null;
260
+ this.dragDepth = 0;
261
+ this.hasNewRoot = false;
262
+ this.pointEl = null;
263
+
264
+ for (var i=0; i<touchedlists.length; i++) {
265
+ if (!touchedlists[i].children().length) {
266
+ touchedlists[i].append(this.tplempty);
267
+ }
268
+ }
269
+
270
+ touchedlists = [];
271
+ },
272
+
273
+ toggleItem: function(li) {
274
+ this[li.hasClass(this.options.collapsedClass) ? "expandItem":"collapseItem"](li);
275
+ },
276
+
277
+ expandItem: function(li) {
278
+ li.removeClass(this.options.collapsedClass);
279
+ },
280
+
281
+ collapseItem: function(li) {
282
+ var lists = li.children(this.options.listNodeName);
283
+ if (lists.length) {
284
+ li.addClass(this.options.collapsedClass);
285
+ }
286
+ },
287
+
288
+ expandAll: function() {
289
+ var list = this;
290
+ this.find(list.options.itemNodeName).each(function() {
291
+ list.expandItem($(this));
292
+ });
293
+ },
294
+
295
+ collapseAll: function() {
296
+ var list = this;
297
+ this.find(list.options.itemNodeName).each(function() {
298
+ list.collapseItem($(this));
299
+ });
300
+ },
301
+
302
+ setParent: function(li) {
303
+ if (li.children(this.options.listNodeName).length) {
304
+ li.addClass("uk-parent");
305
+ }
306
+ },
307
+
308
+ unsetParent: function(li) {
309
+ li.removeClass('uk-parent '+this.options.collapsedClass);
310
+ li.children(this.options.listNodeName).remove();
311
+ },
312
+
313
+ dragStart: function(e) {
314
+ var mouse = this.mouse,
315
+ target = $(e.target),
316
+ dragItem = target.closest(this.options.itemNodeName),
317
+ offset = dragItem.offset();
318
+
319
+ this.placeEl.css('height', dragItem.height());
320
+
321
+ mouse.offsetX = e.pageX - offset.left;
322
+ mouse.offsetY = e.pageY - offset.top;
323
+
324
+ mouse.startX = mouse.lastX = offset.left;
325
+ mouse.startY = mouse.lastY = offset.top;
326
+
327
+ this.dragRootEl = this.element;
328
+
329
+ this.dragEl = $(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass);
330
+ this.dragEl.css('width', dragItem.width());
331
+
332
+ this.tmpDragOnSiblings = [dragItem[0].previousSibling, dragItem[0].nextSibling];
333
+
334
+ // fix for zepto.js
335
+ //dragItem.after(this.placeEl).detach().appendTo(this.dragEl);
336
+ dragItem.after(this.placeEl);
337
+ dragItem[0].parentNode.removeChild(dragItem[0]);
338
+ dragItem.appendTo(this.dragEl);
339
+
340
+ $(document.body).append(this.dragEl);
341
+
342
+ this.dragEl.css({
343
+ left : offset.left,
344
+ top : offset.top
345
+ });
346
+
347
+ // total depth of dragging item
348
+ var i, depth,
349
+ items = this.dragEl.find(this.options.itemNodeName);
350
+ for (i = 0; i < items.length; i++) {
351
+ depth = $(items[i]).parents(this.options.listNodeName).length;
352
+ if (depth > this.dragDepth) {
353
+ this.dragDepth = depth;
354
+ }
355
+ }
356
+
357
+ html.addClass(this.options.movingClass);
358
+ },
359
+
360
+ dragStop: function(e) {
361
+ // fix for zepto.js
362
+ //this.placeEl.replaceWith(this.dragEl.children(this.options.itemNodeName + ':first').detach());
363
+ var el = this.dragEl.children(this.options.itemNodeName).first();
364
+ el[0].parentNode.removeChild(el[0]);
365
+ this.placeEl.replaceWith(el);
366
+
367
+ this.dragEl.remove();
368
+
369
+ if (this.tmpDragOnSiblings[0]!=el[0].previousSibling || this.tmpDragOnSiblings[0]!=el[0].previousSibling) {
370
+
371
+ this.element.trigger('nestable-change',[el, this.hasNewRoot ? "added":"moved"]);
372
+
373
+ if (this.hasNewRoot) {
374
+ this.dragRootEl.trigger('nestable-change', [el, "removed"]);
375
+ }
376
+ }
377
+
378
+ this.reset();
379
+
380
+ html.removeClass(this.options.movingClass);
381
+ },
382
+
383
+ dragMove: function(e) {
384
+ var list, parent, prev, next, depth,
385
+ opt = this.options,
386
+ mouse = this.mouse;
387
+
388
+ this.dragEl.css({
389
+ left : e.pageX - mouse.offsetX,
390
+ top : e.pageY - mouse.offsetY
391
+ });
392
+
393
+ // mouse position last events
394
+ mouse.lastX = mouse.nowX;
395
+ mouse.lastY = mouse.nowY;
396
+ // mouse position this events
397
+ mouse.nowX = e.pageX;
398
+ mouse.nowY = e.pageY;
399
+ // distance mouse moved between events
400
+ mouse.distX = mouse.nowX - mouse.lastX;
401
+ mouse.distY = mouse.nowY - mouse.lastY;
402
+ // direction mouse was moving
403
+ mouse.lastDirX = mouse.dirX;
404
+ mouse.lastDirY = mouse.dirY;
405
+ // direction mouse is now moving (on both axis)
406
+ mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
407
+ mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
408
+ // axis mouse is now moving on
409
+ var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
410
+
411
+ // do nothing on first move
412
+ if (!mouse.moving) {
413
+ mouse.dirAx = newAx;
414
+ mouse.moving = true;
415
+ return;
416
+ }
417
+
418
+ // calc distance moved on this axis (and direction)
419
+ if (mouse.dirAx !== newAx) {
420
+ mouse.distAxX = 0;
421
+ mouse.distAxY = 0;
422
+ } else {
423
+ mouse.distAxX += Math.abs(mouse.distX);
424
+ if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
425
+ mouse.distAxX = 0;
426
+ }
427
+ mouse.distAxY += Math.abs(mouse.distY);
428
+ if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
429
+ mouse.distAxY = 0;
430
+ }
431
+ }
432
+ mouse.dirAx = newAx;
433
+
434
+ /**
435
+ * move horizontal
436
+ */
437
+ if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
438
+ // reset move distance on x-axis for new phase
439
+ mouse.distAxX = 0;
440
+ prev = this.placeEl.prev(opt.itemNodeName);
441
+ // increase horizontal level if previous sibling exists and is not collapsed
442
+ if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass)) {
443
+ // cannot increase level when item above is collapsed
444
+ list = prev.find(opt.listNodeName).last();
445
+ // check if depth limit has reached
446
+ depth = this.placeEl.parents(opt.listNodeName).length;
447
+ if (depth + this.dragDepth <= opt.maxDepth) {
448
+ // create new sub-level if one doesn't exist
449
+ if (!list.length) {
450
+ list = $('<' + opt.listNodeName + '/>').addClass(opt.listClass);
451
+ list.append(this.placeEl);
452
+ prev.append(list);
453
+ this.setParent(prev);
454
+ } else {
455
+ // else append to next level up
456
+ list = prev.children(opt.listNodeName).last();
457
+ list.append(this.placeEl);
458
+ }
459
+ }
460
+ }
461
+ // decrease horizontal level
462
+ if (mouse.distX < 0) {
463
+ // we can't decrease a level if an item preceeds the current one
464
+ next = this.placeEl.next(opt.itemNodeName);
465
+ if (!next.length) {
466
+ parent = this.placeEl.parent();
467
+ this.placeEl.closest(opt.itemNodeName).after(this.placeEl);
468
+ if (!parent.children().length) {
469
+ this.unsetParent(parent.parent());
470
+ }
471
+ }
472
+ }
473
+ }
474
+
475
+ var isEmpty = false;
476
+
477
+ // find list item under cursor
478
+ if (!hasPointerEvents) {
479
+ this.dragEl[0].style.visibility = 'hidden';
480
+ }
481
+ this.pointEl = $(document.elementFromPoint(e.pageX - document.body.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop)));
482
+ if (!hasPointerEvents) {
483
+ this.dragEl[0].style.visibility = 'visible';
484
+ }
485
+
486
+ if (this.pointEl.hasClass(opt.handleClass)) {
487
+ this.pointEl = this.pointEl.closest(opt.itemNodeName);
488
+ } else {
489
+
490
+ var nestableitem = this.pointEl.closest('.'+opt.itemClass);
491
+
492
+ if(nestableitem.length) {
493
+ this.pointEl = nestableitem.closest(opt.itemNodeName);
494
+ }
495
+ }
496
+
497
+ if (this.pointEl.hasClass(opt.emptyClass)) {
498
+ isEmpty = true;
499
+ } else if (this.pointEl.data('nestable') && !this.pointEl.children().length) {
500
+ isEmpty = true;
501
+ this.pointEl = $(this.tplempty).appendTo(this.pointEl);
502
+ } else if (!this.pointEl.length || !this.pointEl.hasClass(opt.listitemClass)) {
503
+ return;
504
+ }
505
+
506
+ // find parent list of item under cursor
507
+ var pointElRoot = this.element,
508
+ tmpRoot = this.pointEl.closest('.'+this.options.listBaseClass),
509
+ isNewRoot = pointElRoot[0] !== this.pointEl.closest('.'+this.options.listBaseClass)[0],
510
+ $newRoot = tmpRoot;
511
+
512
+ /**
513
+ * move vertical
514
+ */
515
+ if (!mouse.dirAx || isNewRoot || isEmpty) {
516
+ // check if groups match if dragging over new root
517
+ if (isNewRoot && opt.group !== $newRoot.data('nestable-group')) {
518
+ return;
519
+ } else {
520
+ touchedlists.push(pointElRoot);
521
+ }
522
+
523
+ // check depth limit
524
+ depth = this.dragDepth - 1 + this.pointEl.parents(opt.listNodeName).length;
525
+
526
+ if (depth > opt.maxDepth) {
527
+ return;
528
+ }
529
+
530
+ var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
531
+
532
+ parent = this.placeEl.parent();
533
+
534
+ // if empty create new list to replace empty placeholder
535
+ if (isEmpty) {
536
+ this.pointEl.replaceWith(this.placeEl);
537
+ } else if (before) {
538
+ this.pointEl.before(this.placeEl);
539
+ } else {
540
+ this.pointEl.after(this.placeEl);
541
+ }
542
+
543
+ if (!parent.children().length) {
544
+ if(!parent.data("nestable")) this.unsetParent(parent.parent());
545
+ }
546
+
547
+ if (!this.dragRootEl.find(opt.itemNodeName).length && !this.dragRootEl.children().length) {
548
+ this.dragRootEl.append(this.tplempty);
549
+ }
550
+
551
+ // parent root list has changed
552
+ if (isNewRoot) {
553
+ this.dragRootEl = tmpRoot;
554
+ this.hasNewRoot = this.element[0] !== this.dragRootEl[0];
555
+ }
556
+ }
557
+ }
558
+
559
+ });
560
+
561
+ $(document).on("uk-domready", function(e) {
562
+
563
+ $("[data-uk-nestable]").each(function(){
564
+
565
+ var ele = $(this);
566
+
567
+ if(!ele.data("nestable")) {
568
+ var plugin = UI.nestable(ele, UI.Utils.options(ele.attr("data-uk-nestable")));
569
+ }
570
+ });
571
+ });
572
+
573
+ return UI.nestable;
574
+ });