blob: 169d7bfa5422a0143c06f0bc4bac35a922ac1d85 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
module VotesHelper
def voters_list(votes, html = false)
voters = votes.select {|v| !v.liker_url.nil?}.map do |v|
if html
tag.strong(link_to v.liker_name, v.liker_url)
else
"#{v.liker_name} (#{v.liker_url})"
end
end
anons = votes.select {|v| v.liker_url.nil?}.size
if anons > 0
if voters.empty? && anons == 1
if html
voters << tag.strong("A guest")
else
voters << "A guest"
end
else
if html
voters << tag.strong(pluralize(anons, "guest"))
else
voters << pluralize(anons, "guest")
end
end
end
to_sentence(voters)
end
end
|