rails-uikit 2.8.0
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.
- data/lib/rails/uikit/engine.rb +6 -0
- data/lib/rails/uikit/version.rb +5 -0
- data/lib/rails/uikit.rb +8 -0
- data/public/fonts/FontAwesome.otf +0 -0
- data/public/fonts/fontawesome-webfont.eot +0 -0
- data/public/fonts/fontawesome-webfont.ttf +0 -0
- data/public/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/javascripts/addons/autocomplete.js +306 -0
- data/vendor/assets/javascripts/addons/autocomplete.min.js +3 -0
- data/vendor/assets/javascripts/addons/datepicker.js +365 -0
- data/vendor/assets/javascripts/addons/datepicker.min.js +3 -0
- data/vendor/assets/javascripts/addons/form-password.js +62 -0
- data/vendor/assets/javascripts/addons/form-password.min.js +3 -0
- data/vendor/assets/javascripts/addons/form-select.js +62 -0
- data/vendor/assets/javascripts/addons/form-select.min.js +3 -0
- data/vendor/assets/javascripts/addons/htmleditor.js +594 -0
- data/vendor/assets/javascripts/addons/htmleditor.min.js +3 -0
- data/vendor/assets/javascripts/addons/nestable.js +574 -0
- data/vendor/assets/javascripts/addons/nestable.min.js +3 -0
- data/vendor/assets/javascripts/addons/notify.js +177 -0
- data/vendor/assets/javascripts/addons/notify.min.js +3 -0
- data/vendor/assets/javascripts/addons/pagination.js +146 -0
- data/vendor/assets/javascripts/addons/pagination.min.js +3 -0
- data/vendor/assets/javascripts/addons/search.js +90 -0
- data/vendor/assets/javascripts/addons/search.min.js +3 -0
- data/vendor/assets/javascripts/addons/sortable.js +494 -0
- data/vendor/assets/javascripts/addons/sortable.min.js +3 -0
- data/vendor/assets/javascripts/addons/sticky.js +130 -0
- data/vendor/assets/javascripts/addons/sticky.min.js +3 -0
- data/vendor/assets/javascripts/addons/timepicker.js +163 -0
- data/vendor/assets/javascripts/addons/timepicker.min.js +3 -0
- data/vendor/assets/javascripts/addons/upload.js +239 -0
- data/vendor/assets/javascripts/addons/upload.min.js +3 -0
- data/vendor/assets/javascripts/uikit.js +2573 -0
- data/vendor/assets/javascripts/uikit.min.js +4 -0
- data/vendor/assets/stylesheets/addons/uikit.addons.css +1124 -0
- data/vendor/assets/stylesheets/addons/uikit.addons.min.css +3 -0
- data/vendor/assets/stylesheets/addons/uikit.almost-flat.addons.css +1205 -0
- data/vendor/assets/stylesheets/addons/uikit.almost-flat.addons.min.css +3 -0
- data/vendor/assets/stylesheets/addons/uikit.gradient.addons.css +1226 -0
- data/vendor/assets/stylesheets/addons/uikit.gradient.addons.min.css +3 -0
- data/vendor/assets/stylesheets/uikit.almost-flat.css +7022 -0
- data/vendor/assets/stylesheets/uikit.almost-flat.min.css +3 -0
- data/vendor/assets/stylesheets/uikit.css +6732 -0
- data/vendor/assets/stylesheets/uikit.gradient.css +7090 -0
- data/vendor/assets/stylesheets/uikit.gradient.min.css +3 -0
- data/vendor/assets/stylesheets/uikit.min.css +3 -0
- metadata +125 -0
data/lib/rails/uikit.rb
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,306 @@
|
|
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-autocomplete", ["uikit"], function(){
|
13
|
+
return component || addon(jQuery, jQuery.UIkit);
|
14
|
+
});
|
15
|
+
}
|
16
|
+
|
17
|
+
})(function($, UI){
|
18
|
+
|
19
|
+
UI.component('autocomplete', {
|
20
|
+
|
21
|
+
defaults: {
|
22
|
+
minLength: 3,
|
23
|
+
param: 'search',
|
24
|
+
method: 'post',
|
25
|
+
delay: 300,
|
26
|
+
loadingClass: 'uk-loading',
|
27
|
+
flipDropdown: false,
|
28
|
+
skipClass: 'uk-skip',
|
29
|
+
hoverClass: 'uk-active',
|
30
|
+
source: null,
|
31
|
+
renderer: null,
|
32
|
+
|
33
|
+
// template
|
34
|
+
|
35
|
+
template: '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'
|
36
|
+
},
|
37
|
+
|
38
|
+
visible : false,
|
39
|
+
value : null,
|
40
|
+
selected : null,
|
41
|
+
|
42
|
+
init: function() {
|
43
|
+
|
44
|
+
var $this = this,
|
45
|
+
select = false,
|
46
|
+
trigger = UI.Utils.debounce(function(e) {
|
47
|
+
if(select) {
|
48
|
+
return (select = false);
|
49
|
+
}
|
50
|
+
$this.handle();
|
51
|
+
}, this.options.delay);
|
52
|
+
|
53
|
+
|
54
|
+
this.dropdown = this.find('.uk-dropdown');
|
55
|
+
this.template = this.find('script[type="text/autocomplete"]').html();
|
56
|
+
this.template = UI.Utils.template(this.template || this.options.template);
|
57
|
+
this.input = this.find("input:first").attr("autocomplete", "off");
|
58
|
+
|
59
|
+
if (!this.dropdown.length) {
|
60
|
+
this.dropdown = $('<div class="uk-dropdown"></div>').appendTo(this.element);
|
61
|
+
}
|
62
|
+
|
63
|
+
if (this.options.flipDropdown) {
|
64
|
+
this.dropdown.addClass('uk-dropdown-flip');
|
65
|
+
}
|
66
|
+
|
67
|
+
this.input.on({
|
68
|
+
"keydown": function(e) {
|
69
|
+
|
70
|
+
if (e && e.which && !e.shiftKey) {
|
71
|
+
|
72
|
+
switch (e.which) {
|
73
|
+
case 13: // enter
|
74
|
+
select = true;
|
75
|
+
|
76
|
+
if ($this.selected) {
|
77
|
+
e.preventDefault();
|
78
|
+
$this.select();
|
79
|
+
}
|
80
|
+
break;
|
81
|
+
case 38: // up
|
82
|
+
e.preventDefault();
|
83
|
+
$this.pick('prev', true);
|
84
|
+
break;
|
85
|
+
case 40: // down
|
86
|
+
e.preventDefault();
|
87
|
+
$this.pick('next', true);
|
88
|
+
break;
|
89
|
+
case 27:
|
90
|
+
case 9: // esc, tab
|
91
|
+
$this.hide();
|
92
|
+
break;
|
93
|
+
default:
|
94
|
+
break;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
},
|
99
|
+
"keyup": trigger,
|
100
|
+
"blur": function(e) {
|
101
|
+
setTimeout(function() { $this.hide(); }, 200);
|
102
|
+
}
|
103
|
+
});
|
104
|
+
|
105
|
+
this.dropdown.on("click", ".uk-autocomplete-results > *", function(){
|
106
|
+
$this.select();
|
107
|
+
});
|
108
|
+
|
109
|
+
this.dropdown.on("mouseover", ".uk-autocomplete-results > *", function(){
|
110
|
+
$this.pick($(this));
|
111
|
+
});
|
112
|
+
|
113
|
+
this.triggercomplete = trigger;
|
114
|
+
},
|
115
|
+
|
116
|
+
handle: function() {
|
117
|
+
|
118
|
+
var $this = this, old = this.value;
|
119
|
+
|
120
|
+
this.value = this.input.val();
|
121
|
+
|
122
|
+
if (this.value.length < this.options.minLength) return this.hide();
|
123
|
+
|
124
|
+
if (this.value != old) {
|
125
|
+
$this.request();
|
126
|
+
}
|
127
|
+
|
128
|
+
return this;
|
129
|
+
},
|
130
|
+
|
131
|
+
pick: function(item, scrollinview) {
|
132
|
+
|
133
|
+
var $this = this,
|
134
|
+
items = this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')'),
|
135
|
+
selected = false;
|
136
|
+
|
137
|
+
if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
|
138
|
+
selected = item;
|
139
|
+
} else if (item == 'next' || item == 'prev') {
|
140
|
+
|
141
|
+
if (this.selected) {
|
142
|
+
var index = items.index(this.selected);
|
143
|
+
|
144
|
+
if (item == 'next') {
|
145
|
+
selected = items.eq(index + 1 < items.length ? index + 1 : 0);
|
146
|
+
} else {
|
147
|
+
selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
|
148
|
+
}
|
149
|
+
|
150
|
+
} else {
|
151
|
+
selected = items[(item == 'next') ? 'first' : 'last']();
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
if (selected && selected.length) {
|
156
|
+
this.selected = selected;
|
157
|
+
items.removeClass(this.options.hoverClass);
|
158
|
+
this.selected.addClass(this.options.hoverClass);
|
159
|
+
|
160
|
+
// jump to selected if not in view
|
161
|
+
if (scrollinview) {
|
162
|
+
|
163
|
+
var top = selected.position().top,
|
164
|
+
scrollTop = $this.dropdown.scrollTop(),
|
165
|
+
dpheight = $this.dropdown.height();
|
166
|
+
|
167
|
+
if (top > dpheight || top < 0) {
|
168
|
+
$this.dropdown.scrollTop(scrollTop + top);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
},
|
173
|
+
|
174
|
+
select: function() {
|
175
|
+
|
176
|
+
if(!this.selected) return;
|
177
|
+
|
178
|
+
var data = this.selected.data();
|
179
|
+
|
180
|
+
this.trigger("autocomplete-select", [data, this]);
|
181
|
+
|
182
|
+
if (data.value) {
|
183
|
+
this.input.val(data.value);
|
184
|
+
}
|
185
|
+
|
186
|
+
this.hide();
|
187
|
+
},
|
188
|
+
|
189
|
+
show: function() {
|
190
|
+
if (this.visible) return;
|
191
|
+
this.visible = true;
|
192
|
+
this.element.addClass("uk-open");
|
193
|
+
return this;
|
194
|
+
},
|
195
|
+
|
196
|
+
hide: function() {
|
197
|
+
if (!this.visible) return;
|
198
|
+
this.visible = false;
|
199
|
+
this.element.removeClass("uk-open");
|
200
|
+
return this;
|
201
|
+
},
|
202
|
+
|
203
|
+
request: function() {
|
204
|
+
|
205
|
+
var $this = this,
|
206
|
+
release = function(data) {
|
207
|
+
|
208
|
+
if(data) {
|
209
|
+
$this.render(data);
|
210
|
+
}
|
211
|
+
|
212
|
+
$this.element.removeClass($this.options.loadingClass);
|
213
|
+
};
|
214
|
+
|
215
|
+
this.element.addClass(this.options.loadingClass);
|
216
|
+
|
217
|
+
if (this.options.source) {
|
218
|
+
|
219
|
+
var source = this.options.source;
|
220
|
+
|
221
|
+
switch(typeof(this.options.source)) {
|
222
|
+
case 'function':
|
223
|
+
|
224
|
+
this.options.source.apply(this, [release]);
|
225
|
+
|
226
|
+
break;
|
227
|
+
|
228
|
+
case 'object':
|
229
|
+
|
230
|
+
if(source.length) {
|
231
|
+
|
232
|
+
var items = [];
|
233
|
+
|
234
|
+
source.forEach(function(item){
|
235
|
+
if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
|
236
|
+
items.push(item);
|
237
|
+
}
|
238
|
+
});
|
239
|
+
|
240
|
+
release(items);
|
241
|
+
}
|
242
|
+
|
243
|
+
break;
|
244
|
+
|
245
|
+
case 'string':
|
246
|
+
|
247
|
+
var params ={};
|
248
|
+
|
249
|
+
params[this.options.param] = this.value;
|
250
|
+
|
251
|
+
$.ajax({
|
252
|
+
url: this.options.source,
|
253
|
+
data: params,
|
254
|
+
type: this.options.method,
|
255
|
+
dataType: 'json',
|
256
|
+
complete: function(xhr) {
|
257
|
+
release(xhr.responseJSON || []);
|
258
|
+
}
|
259
|
+
});
|
260
|
+
|
261
|
+
break;
|
262
|
+
|
263
|
+
default:
|
264
|
+
release(null);
|
265
|
+
}
|
266
|
+
|
267
|
+
} else {
|
268
|
+
this.element.removeClass($this.options.loadingClass);
|
269
|
+
}
|
270
|
+
},
|
271
|
+
|
272
|
+
render: function(data) {
|
273
|
+
|
274
|
+
var $this = this;
|
275
|
+
|
276
|
+
this.dropdown.empty();
|
277
|
+
|
278
|
+
this.selected = false;
|
279
|
+
|
280
|
+
if (this.options.renderer) {
|
281
|
+
|
282
|
+
this.options.renderer.apply(this, [data]);
|
283
|
+
|
284
|
+
} else if(data && data.length) {
|
285
|
+
|
286
|
+
this.dropdown.append(this.template({"items":data}));
|
287
|
+
this.show();
|
288
|
+
|
289
|
+
this.trigger('autocomplete-show');
|
290
|
+
}
|
291
|
+
|
292
|
+
return this;
|
293
|
+
}
|
294
|
+
});
|
295
|
+
|
296
|
+
// init code
|
297
|
+
$(document).on("focus.autocomplete.uikit", "[data-uk-autocomplete]", function(e) {
|
298
|
+
|
299
|
+
var ele = $(this);
|
300
|
+
if (!ele.data("autocomplete")) {
|
301
|
+
var obj = UI.autocomplete(ele, UI.Utils.options(ele.attr("data-uk-autocomplete")));
|
302
|
+
}
|
303
|
+
});
|
304
|
+
|
305
|
+
return UI.autocomplete;
|
306
|
+
});
|
@@ -0,0 +1,3 @@
|
|
1
|
+
/*! UIkit 2.8.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
|
3
|
+
!function(a){var b;jQuery&&jQuery.UIkit&&(b=a(jQuery,jQuery.UIkit)),"function"==typeof define&&define.amd&&define("uikit-autocomplete",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){return b.component("autocomplete",{defaults:{minLength:3,param:"search",method:"post",delay:300,loadingClass:"uk-loading",flipDropdown:!1,skipClass:"uk-skip",hoverClass:"uk-active",source:null,renderer:null,template:'<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'},visible:!1,value:null,selected:null,init:function(){var c=this,d=!1,e=b.Utils.debounce(function(){return d?d=!1:void c.handle()},this.options.delay);this.dropdown=this.find(".uk-dropdown"),this.template=this.find('script[type="text/autocomplete"]').html(),this.template=b.Utils.template(this.template||this.options.template),this.input=this.find("input:first").attr("autocomplete","off"),this.dropdown.length||(this.dropdown=a('<div class="uk-dropdown"></div>').appendTo(this.element)),this.options.flipDropdown&&this.dropdown.addClass("uk-dropdown-flip"),this.input.on({keydown:function(a){if(a&&a.which&&!a.shiftKey)switch(a.which){case 13:d=!0,c.selected&&(a.preventDefault(),c.select());break;case 38:a.preventDefault(),c.pick("prev",!0);break;case 40:a.preventDefault(),c.pick("next",!0);break;case 27:case 9:c.hide()}},keyup:e,blur:function(){setTimeout(function(){c.hide()},200)}}),this.dropdown.on("click",".uk-autocomplete-results > *",function(){c.select()}),this.dropdown.on("mouseover",".uk-autocomplete-results > *",function(){c.pick(a(this))}),this.triggercomplete=e},handle:function(){var a=this,b=this.value;return this.value=this.input.val(),this.value.length<this.options.minLength?this.hide():(this.value!=b&&a.request(),this)},pick:function(a,b){var c=this,d=this.dropdown.find(".uk-autocomplete-results").children(":not(."+this.options.skipClass+")"),e=!1;if("string"==typeof a||a.hasClass(this.options.skipClass)){if("next"==a||"prev"==a)if(this.selected){var f=d.index(this.selected);e=d.eq("next"==a?f+1<d.length?f+1:0:0>f-1?d.length-1:f-1)}else e=d["next"==a?"first":"last"]()}else e=a;if(e&&e.length&&(this.selected=e,d.removeClass(this.options.hoverClass),this.selected.addClass(this.options.hoverClass),b)){var g=e.position().top,h=c.dropdown.scrollTop(),i=c.dropdown.height();(g>i||0>g)&&c.dropdown.scrollTop(h+g)}},select:function(){if(this.selected){var a=this.selected.data();this.trigger("autocomplete-select",[a,this]),a.value&&this.input.val(a.value),this.hide()}},show:function(){return this.visible?void 0:(this.visible=!0,this.element.addClass("uk-open"),this)},hide:function(){return this.visible?(this.visible=!1,this.element.removeClass("uk-open"),this):void 0},request:function(){var b=this,c=function(a){a&&b.render(a),b.element.removeClass(b.options.loadingClass)};if(this.element.addClass(this.options.loadingClass),this.options.source){var d=this.options.source;switch(typeof this.options.source){case"function":this.options.source.apply(this,[c]);break;case"object":if(d.length){var e=[];d.forEach(function(a){a.value&&-1!=a.value.toLowerCase().indexOf(b.value.toLowerCase())&&e.push(a)}),c(e)}break;case"string":var f={};f[this.options.param]=this.value,a.ajax({url:this.options.source,data:f,type:this.options.method,dataType:"json",complete:function(a){c(a.responseJSON||[])}});break;default:c(null)}}else this.element.removeClass(b.options.loadingClass)},render:function(a){return this.dropdown.empty(),this.selected=!1,this.options.renderer?this.options.renderer.apply(this,[a]):a&&a.length&&(this.dropdown.append(this.template({items:a})),this.show(),this.trigger("autocomplete-show")),this}}),a(document).on("focus.autocomplete.uikit","[data-uk-autocomplete]",function(){var c=a(this);if(!c.data("autocomplete")){b.autocomplete(c,b.Utils.options(c.attr("data-uk-autocomplete")))}}),b.autocomplete});
|