liquid_feedback_frontend
view app/main/initiative/_sidebar_state.lua @ 1346:19cdb6123514
Fixed creating account with verification images
| author | bsw | 
|---|---|
| date | Sun Aug 05 19:25:02 2018 +0200 (2018-08-05) | 
| parents | 32cc544d5a5b | 
| children | 7cdc537f991f | 
 line source
     1 local initiative = param.get("initiative", "table")
     4 -- voting results
     5 if initiative.issue.fully_frozen and initiative.issue.closed and initiative.admitted
     6   and initiative.issue.voter_count then
     7   local class = initiative.winner and "sectionRow admitted_info" or "sectionRow not_admitted_info"
     8   ui.container{
     9     attr = { class = class },
    10     content = function()
    11       local max_value = initiative.issue.voter_count
    12       local positive_votes = initiative.positive_votes
    13       local negative_votes = initiative.negative_votes
    14       local abstention_votes = max_value - 
    15               negative_votes - 
    16               positive_votes
    17       local head_text
    19       util.initiative_pie( initiative )
    21       if initiative.winner then
    22         head_text = _"Approved"
    23       elseif initiative.rank then
    24         head_text = _("Rejected (rank #{rank})", { rank = initiative.rank })
    25       else
    26         head_text = _"Rejected"
    27       end
    29       ui.heading { level = 1, content = head_text }
    31       ui.tag { tag = "table", content = function ()
    32         ui.tag { tag = "tr", attr = { class = "yes" }, content = function ()
    33           ui.tag { tag = "td", content = 
    34             tostring(positive_votes) 
    35           }
    36           ui.tag { tag = "th", content = _"Yes" }
    37           ui.tag { tag = "td", content = 
    38             format.percent_floor(positive_votes, max_value) 
    39           }
    40           ui.tag { tag = "th", content = _"Yes" }
    41         end }
    42         ui.tag { tag = "tr", attr = { class = "no" }, content = function ()
    43           ui.tag { tag = "td", content = 
    44             tostring(negative_votes)
    45           }
    46           ui.tag { tag = "th", content = _"No" }
    47           ui.tag { tag = "td", content =
    48             format.percent_floor(negative_votes, max_value) 
    49           }
    50           ui.tag { tag = "th", content = _"No" }
    51         end }
    52         ui.tag { tag = "tr", attr = { class = "abstention" }, content = function ()
    53           ui.tag { tag = "td", content = 
    54             tostring(abstention_votes)
    55           }
    56           ui.tag { tag = "th", content = _"Abstention" }
    57           ui.tag { tag = "td", content =
    58             format.percent_floor(abstention_votes, max_value) 
    59           }
    60           ui.tag { tag = "th", content = _"Abstention" }
    61         end }
    62       end }
    63     end
    64   }
    65 end
    67 -- initiative not admitted info
    68 if initiative.admitted == false then
    69   local policy = initiative.issue.policy
    70   ui.container{
    71     attr = { class = "sectionRow not_admitted_info" },
    72     content = function ()
    73       ui.heading { level = 1, content = _"Initiative not admitted" }
    74       ui.container { content = _("This initiative has not been admitted! It failed the 2nd quorum of #{quorum}.", { quorum = format.percentage ( policy.initiative_quorum_num / policy.initiative_quorum_den ) } ) }
    75     end
    76   }
    77 end
    79 -- initiative revoked info
    80 if initiative.revoked then
    81   ui.container{
    82     attr = { class = "sectionRow revoked_info" },
    83     content = function()
    84       ui.heading { level = 1, content = _"Initiative revoked" }
    85       slot.put(_("This initiative has been revoked at #{revoked} by:", {
    86         revoked = format.timestamp(initiative.revoked)
    87       }))
    88       slot.put(" ")
    89       if app.session:has_access("authors_pseudonymous") then
    90         ui.link{
    91           module = "member", view = "show", id = initiative.revoked_by_member_id,
    92           content = initiative.revoked_by_member.name
    93         }
    94       else
    95         ui.tag{ content = _"[Not public]" }
    96       end
    97       local suggested_initiative = initiative.suggested_initiative
    98       if suggested_initiative then
    99         slot.put("<br /><br />")
   100         slot.put(_("The initiators suggest to support the following initiative:"))
   101         slot.put("<br />")
   102         ui.link{
   103           content = suggested_initiative.display_name,
   104           module = "initiative",
   105           view = "show",
   106           id = suggested_initiative.id
   107         }
   108       end
   109     end
   110   }
   111 end
