alphabetical_paginate 2.0.0 → 2.1.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.
@@ -55,8 +55,6 @@ module AlphabeticalPaginate
|
|
55
55
|
output = self.where("LOWER(%s) REGEXP '^[^a-z0-9].*'" % [params[:db_field], current_field])
|
56
56
|
end
|
57
57
|
end
|
58
|
-
#output.sort! {|x, y| x.send(params[:db_field]) <=> y.send(params[:db_field])}
|
59
|
-
output.order("#{params[:db_field]} ASC")
|
60
58
|
else
|
61
59
|
availableLetters = {}
|
62
60
|
self.find_each({batch_size: params[:batch_size]}) do |x|
|
@@ -83,7 +81,7 @@ module AlphabeticalPaginate
|
|
83
81
|
output.sort! {|x, y| block_given? ? (yield(x).to_s <=> yield(y).to_s) : (x.id.to_s <=> y.id.to_s) }
|
84
82
|
end
|
85
83
|
params[:currentField] = current_field.mb_chars.capitalize.to_s
|
86
|
-
return output, params
|
84
|
+
return ((params[:db_mode] && params[:db_field]) ? output.order("#{params[:db_field]} ASC") : output), params
|
87
85
|
end
|
88
86
|
end
|
89
87
|
end
|
@@ -48,15 +48,15 @@ module AlphabeticalPaginate
|
|
48
48
|
|
49
49
|
element = params[:bootstrap3] ? 'ul' : 'div'
|
50
50
|
if params[:pagination_class] != "none"
|
51
|
-
pagination =
|
51
|
+
pagination = "<#{element} class='pagination %s alpha' style='height:35px;'>" % params[:pagination_class]
|
52
52
|
else
|
53
|
-
pagination =
|
53
|
+
pagination = "<#{element} class='pagination alpha' style='height:35px;'>"
|
54
54
|
end
|
55
55
|
pagination +=
|
56
|
-
params[:bootstrap3] ? "" : "<ul>" +
|
56
|
+
(params[:bootstrap3] ? "" : "<ul>") +
|
57
57
|
links +
|
58
|
-
params[:bootstrap3] ? "" : "</ul>" +
|
59
|
-
"</div>"
|
58
|
+
(params[:bootstrap3] ? "" : "</ul>") +
|
59
|
+
(params[:bootstrap3] ? "" : "</div>")
|
60
60
|
|
61
61
|
output += pagination
|
62
62
|
output.html_safe
|
@@ -3,14 +3,14 @@ $(function() {
|
|
3
3
|
|
4
4
|
var img = "<img src='/assets/aloader.gif' class='loading'/>";
|
5
5
|
// RAILS 3.0 USERS -> Please delete the above line and uncomment the bottom line
|
6
|
-
//
|
7
|
-
|
6
|
+
// ensure that the image directory matches
|
7
|
+
// var img = "<img src='/img/aloader.gif' class='loading'/>";
|
8
8
|
|
9
9
|
var navbar = $(".pagination.alpha a");
|
10
10
|
// Pick the handler list: just a quick check for the jQuery version (see here: http://bugs.jquery.com/ticket/10589)
|
11
|
-
var handlers = navbar.data ? navbar.data('events')
|
11
|
+
var handlers = navbar.data ? navbar.data('events') : jQuery._data(navbar[0], 'events');
|
12
12
|
|
13
|
-
if (-1 !== $.inArray(onNavbarClick, handlers)) {
|
13
|
+
if (!handlers || -1 !== $.inArray(onNavbarClick, handlers.click)) {
|
14
14
|
$(document).on("click", ".pagination.alpha a", onNavbarClick);
|
15
15
|
}
|
16
16
|
|