liquid_feedback_frontend
view env/ui/supporter_count.lua @ 1857:1c329811e47f
Allow to hide password reset and login recover feature
| author | bsw | 
|---|---|
| date | Sat Sep 17 21:32:10 2022 +0200 (2022-09-17) | 
| parents | accb808d5b4a | 
| 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
