paginate_alphabetically 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/view_helpers.rb +9 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/lib/view_helpers.rb
CHANGED
@@ -3,10 +3,17 @@ module PaginateAlphabetically
|
|
3
3
|
def alphabetically_paginate(collection)
|
4
4
|
return "" if collection.empty?
|
5
5
|
available_letters = collection.first.class.pagination_letters
|
6
|
-
content_tag(:ul, alphabetical_links_to(available_letters),
|
6
|
+
content_tag(:ul, safe(alphabetical_links_to(available_letters)),
|
7
7
|
:class => "pagination")
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
|
+
def safe(content)
|
11
|
+
if content.respond_to?(:html_safe)
|
12
|
+
content.html_safe
|
13
|
+
end
|
14
|
+
content
|
15
|
+
end
|
16
|
+
|
10
17
|
def alphabetical_links_to(available_letters)
|
11
18
|
('A'..'Z').map do |letter|
|
12
19
|
content_tag(:li, paginated_letter(available_letters, letter))
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paginate_alphabetically
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eden Development
|