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
@@ -0,0 +1,177 @@
|
|
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-notify", ["uikit"], function(){
|
13
|
+
return component || addon(jQuery, jQuery.UIkit);
|
14
|
+
});
|
15
|
+
}
|
16
|
+
|
17
|
+
})(function($, UI){
|
18
|
+
|
19
|
+
var containers = {},
|
20
|
+
messages = {},
|
21
|
+
|
22
|
+
notify = function(options){
|
23
|
+
|
24
|
+
if ($.type(options) == 'string') {
|
25
|
+
options = { message: options };
|
26
|
+
}
|
27
|
+
|
28
|
+
if (arguments[1]) {
|
29
|
+
options = $.extend(options, $.type(arguments[1]) == 'string' ? {status:arguments[1]} : arguments[1]);
|
30
|
+
}
|
31
|
+
|
32
|
+
return (new Message(options)).show();
|
33
|
+
},
|
34
|
+
closeAll = function(group, instantly){
|
35
|
+
if(group) {
|
36
|
+
for(var id in messages) { if(group===messages[id].group) messages[id].close(instantly); }
|
37
|
+
} else {
|
38
|
+
for(var id in messages) { messages[id].close(instantly); }
|
39
|
+
}
|
40
|
+
};
|
41
|
+
|
42
|
+
var Message = function(options){
|
43
|
+
|
44
|
+
var $this = this;
|
45
|
+
|
46
|
+
this.options = $.extend({}, Message.defaults, options);
|
47
|
+
|
48
|
+
this.uuid = "ID"+(new Date().getTime())+"RAND"+(Math.ceil(Math.random() * 100000));
|
49
|
+
this.element = $([
|
50
|
+
|
51
|
+
'<div class="uk-notify-message">',
|
52
|
+
'<a class="uk-close"></a>',
|
53
|
+
'<div>'+this.options.message+'</div>',
|
54
|
+
'</div>'
|
55
|
+
|
56
|
+
].join('')).data("notifyMessage", this);
|
57
|
+
|
58
|
+
// status
|
59
|
+
if (this.options.status) {
|
60
|
+
this.element.addClass('uk-notify-message-'+this.options.status);
|
61
|
+
this.currentstatus = this.options.status;
|
62
|
+
}
|
63
|
+
|
64
|
+
this.group = this.options.group;
|
65
|
+
|
66
|
+
messages[this.uuid] = this;
|
67
|
+
|
68
|
+
if(!containers[this.options.pos]) {
|
69
|
+
containers[this.options.pos] = $('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo('body').on("click", ".uk-notify-message", function(){
|
70
|
+
$(this).data("notifyMessage").close();
|
71
|
+
});
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
|
76
|
+
$.extend(Message.prototype, {
|
77
|
+
|
78
|
+
uuid: false,
|
79
|
+
element: false,
|
80
|
+
timout: false,
|
81
|
+
currentstatus: "",
|
82
|
+
group: false,
|
83
|
+
|
84
|
+
show: function() {
|
85
|
+
|
86
|
+
if (this.element.is(":visible")) return;
|
87
|
+
|
88
|
+
var $this = this;
|
89
|
+
|
90
|
+
containers[this.options.pos].show().prepend(this.element);
|
91
|
+
|
92
|
+
var marginbottom = parseInt(this.element.css("margin-bottom"), 10);
|
93
|
+
|
94
|
+
this.element.css({"opacity":0, "margin-top": -1*this.element.outerHeight(), "margin-bottom":0}).animate({"opacity":1, "margin-top": 0, "margin-bottom":marginbottom}, function(){
|
95
|
+
|
96
|
+
if ($this.options.timeout) {
|
97
|
+
|
98
|
+
var closefn = function(){ $this.close(); };
|
99
|
+
|
100
|
+
$this.timeout = setTimeout(closefn, $this.options.timeout);
|
101
|
+
|
102
|
+
$this.element.hover(
|
103
|
+
function() { clearTimeout($this.timeout); },
|
104
|
+
function() { $this.timeout = setTimeout(closefn, $this.options.timeout); }
|
105
|
+
);
|
106
|
+
}
|
107
|
+
|
108
|
+
});
|
109
|
+
|
110
|
+
return this;
|
111
|
+
},
|
112
|
+
|
113
|
+
close: function(instantly) {
|
114
|
+
|
115
|
+
var $this = this,
|
116
|
+
finalize = function(){
|
117
|
+
$this.element.remove();
|
118
|
+
|
119
|
+
if(!containers[$this.options.pos].children().length) {
|
120
|
+
containers[$this.options.pos].hide();
|
121
|
+
}
|
122
|
+
|
123
|
+
delete messages[$this.uuid];
|
124
|
+
};
|
125
|
+
|
126
|
+
if(this.timeout) clearTimeout(this.timeout);
|
127
|
+
|
128
|
+
if(instantly) {
|
129
|
+
finalize();
|
130
|
+
} else {
|
131
|
+
this.element.animate({"opacity":0, "margin-top": -1* this.element.outerHeight(), "margin-bottom":0}, function(){
|
132
|
+
finalize();
|
133
|
+
});
|
134
|
+
}
|
135
|
+
},
|
136
|
+
|
137
|
+
content: function(html){
|
138
|
+
|
139
|
+
var container = this.element.find(">div");
|
140
|
+
|
141
|
+
if(!html) {
|
142
|
+
return container.html();
|
143
|
+
}
|
144
|
+
|
145
|
+
container.html(html);
|
146
|
+
|
147
|
+
return this;
|
148
|
+
},
|
149
|
+
|
150
|
+
status: function(status) {
|
151
|
+
|
152
|
+
if(!status) {
|
153
|
+
return this.currentstatus;
|
154
|
+
}
|
155
|
+
|
156
|
+
this.element.removeClass('uk-notify-message-'+this.currentstatus).addClass('uk-notify-message-'+status);
|
157
|
+
|
158
|
+
this.currentstatus = status;
|
159
|
+
|
160
|
+
return this;
|
161
|
+
}
|
162
|
+
});
|
163
|
+
|
164
|
+
Message.defaults = {
|
165
|
+
message: "",
|
166
|
+
status: "",
|
167
|
+
timeout: 5000,
|
168
|
+
group: null,
|
169
|
+
pos: 'top-center'
|
170
|
+
};
|
171
|
+
|
172
|
+
UI.notify = notify;
|
173
|
+
UI.notify.message = Message;
|
174
|
+
UI.notify.closeAll = closeAll;
|
175
|
+
|
176
|
+
return notify;
|
177
|
+
});
|
@@ -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-notify",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){var c={},d={},e=function(b){return"string"==a.type(b)&&(b={message:b}),arguments[1]&&(b=a.extend(b,"string"==a.type(arguments[1])?{status:arguments[1]}:arguments[1])),new g(b).show()},f=function(a,b){if(a)for(var c in d)a===d[c].group&&d[c].close(b);else for(var c in d)d[c].close(b)},g=function(b){this.options=a.extend({},g.defaults,b),this.uuid="ID"+(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random()),this.element=a(['<div class="uk-notify-message">','<a class="uk-close"></a>',"<div>"+this.options.message+"</div>","</div>"].join("")).data("notifyMessage",this),this.options.status&&(this.element.addClass("uk-notify-message-"+this.options.status),this.currentstatus=this.options.status),this.group=this.options.group,d[this.uuid]=this,c[this.options.pos]||(c[this.options.pos]=a('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo("body").on("click",".uk-notify-message",function(){a(this).data("notifyMessage").close()}))};return a.extend(g.prototype,{uuid:!1,element:!1,timout:!1,currentstatus:"",group:!1,show:function(){if(!this.element.is(":visible")){var a=this;c[this.options.pos].show().prepend(this.element);var b=parseInt(this.element.css("margin-bottom"),10);return this.element.css({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0}).animate({opacity:1,"margin-top":0,"margin-bottom":b},function(){if(a.options.timeout){var b=function(){a.close()};a.timeout=setTimeout(b,a.options.timeout),a.element.hover(function(){clearTimeout(a.timeout)},function(){a.timeout=setTimeout(b,a.options.timeout)})}}),this}},close:function(a){var b=this,e=function(){b.element.remove(),c[b.options.pos].children().length||c[b.options.pos].hide(),delete d[b.uuid]};this.timeout&&clearTimeout(this.timeout),a?e():this.element.animate({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0},function(){e()})},content:function(a){var b=this.element.find(">div");return a?(b.html(a),this):b.html()},status:function(a){return a?(this.element.removeClass("uk-notify-message-"+this.currentstatus).addClass("uk-notify-message-"+a),this.currentstatus=a,this):this.currentstatus}}),g.defaults={message:"",status:"",timeout:5e3,group:null,pos:"top-center"},b.notify=e,b.notify.message=g,b.notify.closeAll=f,e});
|
@@ -0,0 +1,146 @@
|
|
1
|
+
/*! UIkit 2.8.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Based on simplePagination - Copyright (c) 2012 Flavius Matis - http://flaviusmatis.github.com/simplePagination.js/ (MIT)
|
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-pagination", ["uikit"], function(){
|
16
|
+
return component || addon(jQuery, jQuery.UIkit);
|
17
|
+
});
|
18
|
+
}
|
19
|
+
|
20
|
+
})(function($, UI){
|
21
|
+
|
22
|
+
"use strict";
|
23
|
+
|
24
|
+
UI.component('pagination', {
|
25
|
+
|
26
|
+
defaults: {
|
27
|
+
items : 1,
|
28
|
+
itemsOnPage : 1,
|
29
|
+
pages : 0,
|
30
|
+
displayedPages : 3,
|
31
|
+
edges : 3,
|
32
|
+
currentPage : 1,
|
33
|
+
lblPrev : false,
|
34
|
+
lblNext : false,
|
35
|
+
onSelectPage : function() {}
|
36
|
+
},
|
37
|
+
|
38
|
+
init: function() {
|
39
|
+
|
40
|
+
var $this = this;
|
41
|
+
|
42
|
+
this.pages = this.options.pages ? this.options.pages : Math.ceil(this.options.items / this.options.itemsOnPage) ? Math.ceil(this.options.items / this.options.itemsOnPage) : 1;
|
43
|
+
this.currentPage = this.options.currentPage - 1;
|
44
|
+
this.halfDisplayed = this.options.displayedPages / 2;
|
45
|
+
|
46
|
+
this.on("click", "a[data-page]", function(e){
|
47
|
+
e.preventDefault();
|
48
|
+
$this.selectPage($(this).data("page"));
|
49
|
+
});
|
50
|
+
|
51
|
+
this._render();
|
52
|
+
},
|
53
|
+
|
54
|
+
_getInterval: function() {
|
55
|
+
|
56
|
+
return {
|
57
|
+
start: Math.ceil(this.currentPage > this.halfDisplayed ? Math.max(Math.min(this.currentPage - this.halfDisplayed, (this.pages - this.options.displayedPages)), 0) : 0),
|
58
|
+
end : Math.ceil(this.currentPage > this.halfDisplayed ? Math.min(this.currentPage + this.halfDisplayed, this.pages) : Math.min(this.options.displayedPages, this.pages))
|
59
|
+
};
|
60
|
+
},
|
61
|
+
|
62
|
+
render: function(pages) {
|
63
|
+
this.pages = pages ? pages : this.pages;
|
64
|
+
this._render();
|
65
|
+
},
|
66
|
+
|
67
|
+
selectPage: function(pageIndex, pages) {
|
68
|
+
this.currentPage = pageIndex;
|
69
|
+
this.render(pages);
|
70
|
+
|
71
|
+
this.options.onSelectPage.apply(this, [pageIndex]);
|
72
|
+
this.trigger('uk-select-page', [pageIndex, this]);
|
73
|
+
},
|
74
|
+
|
75
|
+
_render: function() {
|
76
|
+
|
77
|
+
var o = this.options, interval = this._getInterval(), i;
|
78
|
+
|
79
|
+
this.element.empty();
|
80
|
+
|
81
|
+
// Generate Prev link
|
82
|
+
if (o.lblPrev) this._append(o.currentPage - 1, {text: o.lblPrev});
|
83
|
+
|
84
|
+
// Generate start edges
|
85
|
+
if (interval.start > 0 && o.edges > 0) {
|
86
|
+
|
87
|
+
var end = Math.min(o.edges, interval.start);
|
88
|
+
|
89
|
+
for (i = 0; i < end; i++) this._append(i);
|
90
|
+
|
91
|
+
if (o.edges < interval.start && (interval.start - o.edges != 1)) {
|
92
|
+
this.element.append('<li><span>...</span></li>');
|
93
|
+
} else if (interval.start - o.edges == 1) {
|
94
|
+
this._append(o.edges);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
// Generate interval links
|
99
|
+
for (i = interval.start; i < interval.end; i++) this._append(i);
|
100
|
+
|
101
|
+
// Generate end edges
|
102
|
+
if (interval.end < this.pages && o.edges > 0) {
|
103
|
+
|
104
|
+
if (this.pages - o.edges > interval.end && (this.pages - o.edges - interval.end != 1)) {
|
105
|
+
this.element.append('<li><span>...</span></li>');
|
106
|
+
} else if (this.pages - o.edges - interval.end == 1) {
|
107
|
+
this._append(interval.end++);
|
108
|
+
}
|
109
|
+
|
110
|
+
var begin = Math.max(this.pages - o.edges, interval.end);
|
111
|
+
|
112
|
+
for (i = begin; i < this.pages; i++) this._append(i);
|
113
|
+
}
|
114
|
+
|
115
|
+
// Generate Next link (unless option is set for at front)
|
116
|
+
if (o.lblNext) this._append(o.currentPage + 1, {text: o.lblNext});
|
117
|
+
},
|
118
|
+
|
119
|
+
_append: function(pageIndex, opts) {
|
120
|
+
|
121
|
+
var $this = this, item, link, options;
|
122
|
+
|
123
|
+
pageIndex = pageIndex < 0 ? 0 : (pageIndex < this.pages ? pageIndex : this.pages - 1);
|
124
|
+
options = $.extend({ text: pageIndex + 1 }, opts);
|
125
|
+
|
126
|
+
item = (pageIndex == this.currentPage) ? '<li class="uk-active"><span>' + (options.text) + '</span></li>'
|
127
|
+
: '<li><a href="#page-'+(pageIndex+1)+'" data-page="'+pageIndex+'">'+options.text+'</a></li>';
|
128
|
+
|
129
|
+
this.element.append(item);
|
130
|
+
}
|
131
|
+
});
|
132
|
+
|
133
|
+
// init code
|
134
|
+
$(document).on("uk-domready", function(e) {
|
135
|
+
|
136
|
+
$("[data-uk-pagination]").each(function(){
|
137
|
+
var ele = $(this);
|
138
|
+
|
139
|
+
if (!ele.data("pagination")) {
|
140
|
+
var obj = UI.pagination(ele, UI.Utils.options(ele.attr("data-uk-pagination")));
|
141
|
+
}
|
142
|
+
});
|
143
|
+
});
|
144
|
+
|
145
|
+
return UI.pagination;
|
146
|
+
});
|
@@ -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-pagination",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){"use strict";return b.component("pagination",{defaults:{items:1,itemsOnPage:1,pages:0,displayedPages:3,edges:3,currentPage:1,lblPrev:!1,lblNext:!1,onSelectPage:function(){}},init:function(){var b=this;this.pages=this.options.pages?this.options.pages:Math.ceil(this.options.items/this.options.itemsOnPage)?Math.ceil(this.options.items/this.options.itemsOnPage):1,this.currentPage=this.options.currentPage-1,this.halfDisplayed=this.options.displayedPages/2,this.on("click","a[data-page]",function(c){c.preventDefault(),b.selectPage(a(this).data("page"))}),this._render()},_getInterval:function(){return{start:Math.ceil(this.currentPage>this.halfDisplayed?Math.max(Math.min(this.currentPage-this.halfDisplayed,this.pages-this.options.displayedPages),0):0),end:Math.ceil(this.currentPage>this.halfDisplayed?Math.min(this.currentPage+this.halfDisplayed,this.pages):Math.min(this.options.displayedPages,this.pages))}},render:function(a){this.pages=a?a:this.pages,this._render()},selectPage:function(a,b){this.currentPage=a,this.render(b),this.options.onSelectPage.apply(this,[a]),this.trigger("uk-select-page",[a,this])},_render:function(){var a,b=this.options,c=this._getInterval();if(this.element.empty(),b.lblPrev&&this._append(b.currentPage-1,{text:b.lblPrev}),c.start>0&&b.edges>0){var d=Math.min(b.edges,c.start);for(a=0;d>a;a++)this._append(a);b.edges<c.start&&c.start-b.edges!=1?this.element.append("<li><span>...</span></li>"):c.start-b.edges==1&&this._append(b.edges)}for(a=c.start;a<c.end;a++)this._append(a);if(c.end<this.pages&&b.edges>0){this.pages-b.edges>c.end&&this.pages-b.edges-c.end!=1?this.element.append("<li><span>...</span></li>"):this.pages-b.edges-c.end==1&&this._append(c.end++);var e=Math.max(this.pages-b.edges,c.end);for(a=e;a<this.pages;a++)this._append(a)}b.lblNext&&this._append(b.currentPage+1,{text:b.lblNext})},_append:function(b,c){var d,e;b=0>b?0:b<this.pages?b:this.pages-1,e=a.extend({text:b+1},c),d=b==this.currentPage?'<li class="uk-active"><span>'+e.text+"</span></li>":'<li><a href="#page-'+(b+1)+'" data-page="'+b+'">'+e.text+"</a></li>",this.element.append(d)}}),a(document).on("uk-domready",function(){a("[data-uk-pagination]").each(function(){var c=a(this);if(!c.data("pagination")){b.pagination(c,b.Utils.options(c.attr("data-uk-pagination")))}})}),b.pagination});
|
@@ -0,0 +1,90 @@
|
|
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
|
+
UI.component('search', {
|
22
|
+
defaults: {
|
23
|
+
msgResultsHeader : 'Search Results',
|
24
|
+
msgMoreResults : 'More Results',
|
25
|
+
msgNoResults : 'No results found',
|
26
|
+
template : '<ul class="uk-nav uk-nav-search uk-autocomplete-results">\
|
27
|
+
{{#msgResultsHeader}}<li class="uk-nav-header uk-skip">{{msgResultsHeader}}</li>{{/msgResultsHeader}}\
|
28
|
+
{{#items && items.length}}\
|
29
|
+
{{~items}}\
|
30
|
+
<li data-url="{{!$item.url}}">\
|
31
|
+
<a href="{{!$item.url}}">\
|
32
|
+
{{{$item.title}}}\
|
33
|
+
{{#$item.text}}<div>{{{$item.text}}}</div>{{/$item.text}}\
|
34
|
+
</a>\
|
35
|
+
</li>\
|
36
|
+
{{/items}}\
|
37
|
+
{{#msgMoreResults}}\
|
38
|
+
<li class="uk-nav-divider uk-skip"></li>\
|
39
|
+
<li class="uk-search-moreresults" data-moreresults="true"><a href="#" onclick="jQuery(this).closest(\'form\').submit();">{{msgMoreResults}}</a></li>\
|
40
|
+
{{/msgMoreResults}}\
|
41
|
+
{{/end}}\
|
42
|
+
{{^items.length}}\
|
43
|
+
{{#msgNoResults}}<li class="uk-skip"><a>{{msgNoResults}}</a></li>{{/msgNoResults}}\
|
44
|
+
{{/end}}\
|
45
|
+
</ul>',
|
46
|
+
|
47
|
+
renderer: function(data) {
|
48
|
+
|
49
|
+
var $this = this, opts = this.options;
|
50
|
+
|
51
|
+
this.dropdown.append(this.template({"items":data.results || [], "msgResultsHeader":opts.msgResultsHeader, "msgMoreResults": opts.msgMoreResults, "msgNoResults": opts.msgNoResults}));
|
52
|
+
this.show();
|
53
|
+
}
|
54
|
+
},
|
55
|
+
|
56
|
+
init: function() {
|
57
|
+
var $this = this;
|
58
|
+
|
59
|
+
this.autocomplete = UI.autocomplete(this.element, this.options);
|
60
|
+
|
61
|
+
this.autocomplete.dropdown.addClass('uk-dropdown-search');
|
62
|
+
|
63
|
+
this.autocomplete.input.on("keyup", function(){
|
64
|
+
$this.element[$this.autocomplete.input.val() ? "addClass":"removeClass"]("uk-active");
|
65
|
+
}).closest("form").on("reset", function(){
|
66
|
+
$this.value="";
|
67
|
+
$this.element.removeClass("uk-active");
|
68
|
+
});
|
69
|
+
|
70
|
+
this.on('autocomplete-select', function(e, data) {
|
71
|
+
if (data.url) {
|
72
|
+
location.href = data.url;
|
73
|
+
} else if(data.moreresults) {
|
74
|
+
this.autocomplete.input.closest('form').submit();
|
75
|
+
}
|
76
|
+
});
|
77
|
+
|
78
|
+
this.element.data("search", this);
|
79
|
+
}
|
80
|
+
});
|
81
|
+
|
82
|
+
// init code
|
83
|
+
$(document).on("focus.search.uikit", "[data-uk-search]", function(e) {
|
84
|
+
var ele = $(this);
|
85
|
+
|
86
|
+
if (!ele.data("search")) {
|
87
|
+
var obj = UI.search(ele, UI.Utils.options(ele.attr("data-uk-search")));
|
88
|
+
}
|
89
|
+
});
|
90
|
+
});
|
@@ -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-search",["uikit"],function(){return b||a(jQuery,jQuery.UIkit)})}(function(a,b){"use strict";b.component("search",{defaults:{msgResultsHeader:"Search Results",msgMoreResults:"More Results",msgNoResults:"No results found",template:'<ul class="uk-nav uk-nav-search uk-autocomplete-results"> {{#msgResultsHeader}}<li class="uk-nav-header uk-skip">{{msgResultsHeader}}</li>{{/msgResultsHeader}} {{#items && items.length}} {{~items}} <li data-url="{{!$item.url}}"> <a href="{{!$item.url}}"> {{{$item.title}}} {{#$item.text}}<div>{{{$item.text}}}</div>{{/$item.text}} </a> </li> {{/items}} {{#msgMoreResults}} <li class="uk-nav-divider uk-skip"></li> <li class="uk-search-moreresults" data-moreresults="true"><a href="#" onclick="jQuery(this).closest(\'form\').submit();">{{msgMoreResults}}</a></li> {{/msgMoreResults}} {{/end}} {{^items.length}} {{#msgNoResults}}<li class="uk-skip"><a>{{msgNoResults}}</a></li>{{/msgNoResults}} {{/end}} </ul>',renderer:function(a){var b=this.options;this.dropdown.append(this.template({items:a.results||[],msgResultsHeader:b.msgResultsHeader,msgMoreResults:b.msgMoreResults,msgNoResults:b.msgNoResults})),this.show()}},init:function(){var a=this;this.autocomplete=b.autocomplete(this.element,this.options),this.autocomplete.dropdown.addClass("uk-dropdown-search"),this.autocomplete.input.on("keyup",function(){a.element[a.autocomplete.input.val()?"addClass":"removeClass"]("uk-active")}).closest("form").on("reset",function(){a.value="",a.element.removeClass("uk-active")}),this.on("autocomplete-select",function(a,b){b.url?location.href=b.url:b.moreresults&&this.autocomplete.input.closest("form").submit()}),this.element.data("search",this)}}),a(document).on("focus.search.uikit","[data-uk-search]",function(){var c=a(this);if(!c.data("search")){b.search(c,b.Utils.options(c.attr("data-uk-search")))}})});
|