liquid_feedback_frontend

view env/ui/supporter_count.lua @ 1850:accb808d5b4a

Added token based voting
author bsw
date Tue Mar 22 10:19:22 2022 +0100 (2022-03-22)
parents 32cc544d5a5b
children
line source
1 function ui.supporter_count(initiative)
2 if initiative.supporter_count == nil then
3 ui.tag {
4 attr = { class = "supporterCount" },
5 content = _"[calculating]"
6 }
7 elseif initiative.issue.closed == nil then
8 if config.token and initiative.issue.area.unit_id == config.token.unit_id then
9 ui.tag {
10 attr = { class = "satisfiedSupporterCount" },
11 content = _("#{count} #{token_name}", { count = initiative.satisfied_supporter_count / 100, token_name = config.token.token_name })
12 }
13 if initiative.potential_supporter_count and
14 initiative.potential_supporter_count > 0
15 then
16 slot.put ( " " )
17 ui.tag {
18 attr = { class = "potentialSupporterCount" },
19 content = _("(+ #{count} potential)", { count = initiative.potential_supporter_count / 100 })
20 }
21 end
22 else
23 ui.tag {
24 attr = { class = "satisfiedSupporterCount" },
25 content = _("#{count} supporter", { count = initiative.satisfied_supporter_count })
26 }
27 if initiative.potential_supporter_count and
28 initiative.potential_supporter_count > 0
29 then
30 slot.put ( " " )
31 ui.tag {
32 attr = { class = "potentialSupporterCount" },
33 content = _("(+ #{count} potential)", { count = initiative.potential_supporter_count })
34 }
35 end
36 end
37 end
38 end

Impressum / About Us