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