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,130 @@
1
+ /*! UIkit 2.8.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+
3
+ (function(addon) {
4
+
5
+ var component;
6
+
7
+ if (jQuery && jQuery.UIkit) {
8
+ component = addon(jQuery, jQuery.UIkit);
9
+ }
10
+
11
+ if (typeof define == "function" && define.amd) {
12
+ define("uikit-sticky", ["uikit"], function(){
13
+ return component || addon(jQuery, jQuery.UIkit);
14
+ });
15
+ }
16
+
17
+ })(function($, UI){
18
+
19
+ var $win = UI.$win,
20
+ $doc = UI.$doc,
21
+ sticked = [];
22
+
23
+ UI.component('sticky', {
24
+
25
+ defaults: {
26
+ top : 0,
27
+ bottom : 0,
28
+ clsactive : 'uk-active',
29
+ clswrapper : 'uk-sticky',
30
+ getWidthFrom : ''
31
+ },
32
+
33
+ init: function() {
34
+
35
+ var stickyId = this.element.attr('id') || ("s"+Math.ceil(Math.random()*10000)),
36
+ wrapper = $('<div></div>').attr('id', 'sticky-'+stickyId).addClass(this.options.clswrapper);
37
+
38
+ wrapper = this.element.wrap(wrapper).parent().css('height', this.element.outerHeight());
39
+
40
+ if (this.element.css("float") != "none") {
41
+ wrapper.css({"float":this.element.css("float")});
42
+ this.element.css({"float":"none"});
43
+ }
44
+
45
+ sticked.push({
46
+ top: this.options.top,
47
+ bottom: this.options.bottom,
48
+ element: this.element,
49
+ currentTop: null,
50
+ wrapper: wrapper,
51
+ clsactive: this.options.clsactive,
52
+ getWidthFrom: this.options.getWidthFrom || wrapper
53
+ });
54
+ },
55
+
56
+ update: function() {
57
+ scroller();
58
+ }
59
+ });
60
+
61
+ function scroller() {
62
+
63
+ if (!sticked.length) return;
64
+
65
+ var scrollTop = $win.scrollTop(),
66
+ documentHeight = $doc.height(),
67
+ dwh = documentHeight - $win.height(),
68
+ extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
69
+
70
+ for (var i = 0; i < sticked.length; i++) {
71
+
72
+ if (!sticked[i].element.is(":visible")) {
73
+ continue;
74
+ }
75
+
76
+ var sticky = sticked[i],
77
+ elementTop = sticky.wrapper.offset().top,
78
+ etse = elementTop - sticky.top - extra;
79
+
80
+ if (scrollTop <= etse) {
81
+
82
+ if (sticky.currentTop !== null) {
83
+ sticky.element.css({"position":"", "top":"", "width":"", "left":""});
84
+ sticky.wrapper.removeClass(sticky.clsactive);
85
+ sticky.currentTop = null;
86
+ }
87
+
88
+ } else {
89
+
90
+ var newTop = documentHeight - sticky.element.outerHeight() - sticky.top - sticky.bottom - scrollTop - extra;
91
+
92
+ newTop = newTop < 0 ? newTop + sticky.top : sticky.top;
93
+
94
+ if (sticky.currentTop != newTop) {
95
+ sticky.element.css({
96
+ "position" : "fixed",
97
+ "top" : newTop,
98
+ "width" : (typeof sticky.getWidthFrom !== 'undefined') ? $(sticky.getWidthFrom).width() : sticky.element.width(),
99
+ "left" : sticky.wrapper.offset().left
100
+ });
101
+
102
+ sticky.wrapper.addClass(sticky.clsactive);
103
+ sticky.currentTop = newTop;
104
+ }
105
+ }
106
+ }
107
+
108
+ }
109
+
110
+ // should be more efficient than using $win.scroll(scroller):
111
+ $doc.on('uk-scroll', scroller);
112
+
113
+ $doc.on("uk-domready", function(e) {
114
+ setTimeout(function(){
115
+
116
+ scroller();
117
+
118
+ $("[data-uk-sticky]").each(function(){
119
+
120
+ var $ele = $(this);
121
+
122
+ if(!$ele.data("sticky")) {
123
+ UI.sticky($ele, UI.Utils.options($ele.attr('data-uk-sticky')));
124
+ }
125
+ });
126
+ }, 0);
127
+ });
128
+
129
+ return $.fn.uksticky;
130
+ });
@@ -0,0 +1,163 @@
1
+ /*! UIkit 2.8.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+
3
+ (function(addon) {
4
+
5
+ var component;
6
+
7
+ if (jQuery && jQuery.UIkit) {
8
+ component = addon(jQuery, jQuery.UIkit);
9
+ }
10
+
11
+ if (typeof define == "function" && define.amd) {
12
+ define("uikit-search", ["uikit"], function(){
13
+ return component || addon(jQuery, jQuery.UIkit);
14
+ });
15
+ }
16
+
17
+ })(function($, UI){
18
+
19
+ "use strict";
20
+
21
+ var times = {'12h':[], '24h':[]};
22
+
23
+ for(var i = 0, h=''; i<24; i++) {
24
+
25
+ h = ''+i;
26
+
27
+ if(i<10) h = '0'+h;
28
+
29
+ times['24h'].push({value: (h+':00')});
30
+ times['24h'].push({value: (h+':30')});
31
+
32
+ if (i<13) {
33
+ times['12h'].push({value: (h+':00 AM')});
34
+ times['12h'].push({value: (h+':30 AM')});
35
+ }
36
+
37
+ if (i > 12) {
38
+
39
+ h = h-12;
40
+
41
+ if (h < 10) h = '0'+String(h);
42
+
43
+ times['12h'].push({value: (h+':00 PM')});
44
+ times['12h'].push({value: (h+':30 PM')});
45
+ }
46
+ }
47
+
48
+
49
+ UI.component('timepicker', {
50
+
51
+ defaults: {
52
+ format : '24h',
53
+ delay : 0
54
+ },
55
+
56
+ init: function() {
57
+
58
+ var $this = this;
59
+
60
+ this.options.minLength = 0;
61
+ this.options.template = '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>';
62
+
63
+ this.options.source = function(release) {
64
+ release(times[$this.options.format] || times['12h']);
65
+ };
66
+
67
+ this.element.wrap('<div class="uk-autocomplete"></div>');
68
+
69
+ this.autocomplete = UI.autocomplete(this.element.parent(), this.options);
70
+ this.autocomplete.dropdown.addClass('uk-dropdown-scrollable');
71
+
72
+ this.autocomplete.on('autocomplete-show', function() {
73
+
74
+ var selected = $this.autocomplete.dropdown.find('[data-value="'+$this.element.val()+'"]');
75
+
76
+ setTimeout(function(){
77
+ $this.autocomplete.pick(selected, true);
78
+ }, 10);
79
+ });
80
+
81
+ this.element.on('focus', function(){
82
+
83
+ $this.autocomplete.value = Math.random();
84
+ $this.autocomplete.triggercomplete();
85
+
86
+ }).on('blur', function() {
87
+ $this.checkTime();
88
+ });
89
+
90
+ this.element.data("timepicker", this);
91
+ },
92
+
93
+ checkTime: function() {
94
+
95
+ var arr, timeArray, meridian = 'AM', hour, minute, time = this.element.val();
96
+
97
+ if (this.options.format == '12h') {
98
+ arr = time.split(' ');
99
+ timeArray = arr[0].split(':');
100
+ meridian = arr[1];
101
+ } else {
102
+ timeArray = time.split(':');
103
+ }
104
+
105
+ hour = parseInt(timeArray[0], 10);
106
+ minute = parseInt(timeArray[1], 10);
107
+
108
+ if (isNaN(hour)) hour = 0;
109
+ if (isNaN(minute)) minute = 0;
110
+
111
+ if (this.options.format == '12h') {
112
+ if (hour > 12) {
113
+ hour = 12;
114
+ } else if (hour < 0) {
115
+ hour = 12;
116
+ }
117
+
118
+ if (meridian === 'am' || meridian === 'a') {
119
+ meridian = 'AM';
120
+ } else if (meridian === 'pm' || meridian === 'p') {
121
+ meridian = 'PM';
122
+ }
123
+
124
+ if (meridian !== 'AM' && meridian !== 'PM') {
125
+ meridian = 'AM';
126
+ }
127
+
128
+ } else {
129
+
130
+ if (hour >= 24) {
131
+ hour = 23;
132
+ } else if (hour < 0) {
133
+ hour = 0;
134
+ }
135
+ }
136
+
137
+ if (minute < 0) {
138
+ minute = 0;
139
+ } else if (minute >= 60) {
140
+ minute = 0;
141
+ }
142
+
143
+ this.element.val(this.formatTime(hour, minute, meridian));
144
+ },
145
+
146
+ formatTime: function(hour, minute, meridian) {
147
+ hour = hour < 10 ? '0' + hour : hour;
148
+ minute = minute < 10 ? '0' + minute : minute;
149
+ return hour + ':' + minute + (this.options.format == '12h' ? ' ' + meridian : '');
150
+ }
151
+ });
152
+
153
+ // init code
154
+ $(document).on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
155
+ var ele = $(this);
156
+
157
+ if (!ele.data("timepicker")) {
158
+ var obj = UI.timepicker(ele, UI.Utils.options(ele.attr("data-uk-timepicker")));
159
+
160
+ ele.focus();
161
+ }
162
+ });
163
+ });
@@ -0,0 +1,239 @@
1
+ /*! UIkit 2.8.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+
3
+ (function(addon) {
4
+
5
+ var component;
6
+
7
+ if (jQuery && jQuery.UIkit) {
8
+ component = addon(jQuery, jQuery.UIkit);
9
+ }
10
+
11
+ if (typeof define == "function" && define.amd) {
12
+ define("uikit-upload", ["uikit"], function(){
13
+ return component || addon(jQuery, jQuery.UIkit);
14
+ });
15
+ }
16
+
17
+ })(function($, UI){
18
+
19
+ UI.component('uploadSelect', {
20
+
21
+
22
+ init: function() {
23
+
24
+ var $this = this;
25
+
26
+ this.on("change", function() {
27
+ xhrupload($this.element[0].files, $this.options);
28
+ });
29
+ }
30
+ });
31
+
32
+ UI.component('uploadDrop', {
33
+
34
+ defaults: {
35
+ 'dragoverClass': 'uk-dragover'
36
+ },
37
+
38
+ init: function() {
39
+
40
+ var $this = this, hasdragCls = false;
41
+
42
+ this.on("drop", function(e){
43
+
44
+ if (e.dataTransfer && e.dataTransfer.files) {
45
+
46
+ e.stopPropagation();
47
+ e.preventDefault();
48
+
49
+ $this.element.removeClass($this.options.dragoverClass);
50
+
51
+ xhrupload(e.dataTransfer.files, $this.options);
52
+ }
53
+
54
+ }).on("dragenter", function(e){
55
+ e.stopPropagation();
56
+ e.preventDefault();
57
+ }).on("dragover", function(e){
58
+ e.stopPropagation();
59
+ e.preventDefault();
60
+
61
+ if (!hasdragCls) {
62
+ $this.element.addClass($this.options.dragoverClass);
63
+ hasdragCls = true;
64
+ }
65
+ }).on("dragleave", function(e){
66
+ e.stopPropagation();
67
+ e.preventDefault();
68
+ $this.element.removeClass($this.options.dragoverClass);
69
+ hasdragCls = false;
70
+ });
71
+ }
72
+ });
73
+
74
+
75
+ UI.support.ajaxupload = (function() {
76
+
77
+ function supportFileAPI() {
78
+ var fi = document.createElement('INPUT'); fi.type = 'file'; return 'files' in fi;
79
+ }
80
+
81
+ function supportAjaxUploadProgressEvents() {
82
+ var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));
83
+ }
84
+
85
+ function supportFormData() {
86
+ return !! window.FormData;
87
+ }
88
+
89
+ return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData();
90
+ })();
91
+
92
+ if (UI.support.ajaxupload){
93
+ $.event.props.push("dataTransfer");
94
+ }
95
+
96
+ function xhrupload(files, settings) {
97
+
98
+ if (!UI.support.ajaxupload){
99
+ return this;
100
+ }
101
+
102
+ settings = $.extend({}, xhrupload.defaults, settings);
103
+
104
+ if (!files.length){
105
+ return;
106
+ }
107
+
108
+ if (settings.allow !== '*.*') {
109
+
110
+ for(var i=0,file;file=files[i];i++) {
111
+
112
+ if(!matchName(settings.allow, file.name)) {
113
+
114
+ if(typeof(settings.notallowed) == 'string') {
115
+ alert(settings.notallowed);
116
+ } else {
117
+ settings.notallowed(file, settings);
118
+ }
119
+ return;
120
+ }
121
+ }
122
+ }
123
+
124
+ var complete = settings.complete;
125
+
126
+ if (settings.single){
127
+
128
+ var count = files.length,
129
+ uploaded = 0;
130
+
131
+ settings.complete = function(response, xhr){
132
+ uploaded = uploaded+1;
133
+ complete(response, xhr);
134
+ if (uploaded<count){
135
+ upload([files[uploaded]], settings);
136
+ } else {
137
+ settings.allcomplete(response, xhr);
138
+ }
139
+ };
140
+
141
+ upload([files[0]], settings);
142
+
143
+ } else {
144
+
145
+ settings.complete = function(response, xhr){
146
+ complete(response, xhr);
147
+ settings.allcomplete(response, xhr);
148
+ };
149
+
150
+ upload(files, settings);
151
+ }
152
+
153
+ function upload(files, settings){
154
+
155
+ // upload all at once
156
+ var formData = new FormData(), xhr = new XMLHttpRequest();
157
+
158
+ if (settings.before(settings, files)===false) return;
159
+
160
+ for (var i = 0, f; f = files[i]; i++) { formData.append(settings.param, f); }
161
+ for (var p in settings.params) { formData.append(p, settings.params[p]); }
162
+
163
+ // Add any event handlers here...
164
+ xhr.upload.addEventListener("progress", function(e){
165
+ var percent = (e.loaded / e.total)*100;
166
+ settings.progress(percent, e);
167
+ }, false);
168
+
169
+ xhr.addEventListener("loadstart", function(e){ settings.loadstart(e); }, false);
170
+ xhr.addEventListener("load", function(e){ settings.load(e); }, false);
171
+ xhr.addEventListener("loadend", function(e){ settings.loadend(e); }, false);
172
+ xhr.addEventListener("error", function(e){ settings.error(e); }, false);
173
+ xhr.addEventListener("abort", function(e){ settings.abort(e); }, false);
174
+
175
+ xhr.open(settings.method, settings.action, true);
176
+
177
+ xhr.onreadystatechange = function() {
178
+
179
+ settings.readystatechange(xhr);
180
+
181
+ if (xhr.readyState==4){
182
+
183
+ var response = xhr.responseText;
184
+
185
+ if (settings.type=="json") {
186
+ try {
187
+ response = $.parseJSON(response);
188
+ } catch(e) {
189
+ response = false;
190
+ }
191
+ }
192
+
193
+ settings.complete(response, xhr);
194
+ }
195
+ };
196
+
197
+ xhr.send(formData);
198
+ }
199
+ }
200
+
201
+ xhrupload.defaults = {
202
+ 'action': '',
203
+ 'single': true,
204
+ 'method': 'POST',
205
+ 'param' : 'files[]',
206
+ 'params': {},
207
+ 'allow' : '*.*',
208
+ 'type' : 'text',
209
+
210
+ // events
211
+ 'before' : function(o){},
212
+ 'loadstart' : function(){},
213
+ 'load' : function(){},
214
+ 'loadend' : function(){},
215
+ 'error' : function(){},
216
+ 'abort' : function(){},
217
+ 'progress' : function(){},
218
+ 'complete' : function(){},
219
+ 'allcomplete' : function(){},
220
+ 'readystatechange': function(){},
221
+ 'notallowed' : function(file, settings){ alert('Only the following file types are allowed: '+settings.allow); }
222
+ };
223
+
224
+ function matchName(pattern, path) {
225
+
226
+ var parsedPattern = '^' + pattern.replace(/\//g, '\\/').
227
+ replace(/\*\*/g, '(\\/[^\\/]+)*').
228
+ replace(/\*/g, '[^\\/]+').
229
+ replace(/((?!\\))\?/g, '$1.') + '$';
230
+
231
+ parsedPattern = '^' + parsedPattern + '$';
232
+
233
+ return (path.match(new RegExp(parsedPattern, 'i')) !== null);
234
+ }
235
+
236
+ UI.Utils.xhrupload = xhrupload;
237
+
238
+ return xhrupload;
239
+ });