liquid_feedback_frontend
view app/main/initiative/_sidebar_state.lua @ 1218:bb10f001443e
Fixed syntax error in unit sidebar occured after last bug fix again again
| author | bsw | 
|---|---|
| date | Mon Jul 27 23:33:26 2015 +0200 (2015-07-27) | 
| parents | 7e48d429389f | 
| children | 32cc544d5a5b | 
 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
    18       if initiative.winner then
    19         head_text = _"Approved"
    20       elseif initiative.rank then
    21         head_text = _("Rejected (rank #{rank})", { rank = initiative.rank })
    22       else
    23         head_text = _"Rejected"
    24       end
    26       util.initiative_pie( initiative )
    28       ui.heading { level = 1, content = head_text }
    30       ui.tag { tag = "table", content = function ()
    31         ui.tag { tag = "tr", attr = { class = "yes" }, content = function ()
    32           ui.tag { tag = "td", content = 
    33             tostring(positive_votes) 
    34           }
    35           ui.tag { tag = "th", content = _"Yes" }
    36           ui.tag { tag = "td", content = 
    37             format.percent_floor(positive_votes, max_value) 
    38           }
    39           ui.tag { tag = "th", content = _"Yes" }
    40         end }
    41         ui.tag { tag = "tr", attr = { class = "abstention" }, content = function ()
    42           ui.tag { tag = "td", content = 
    43             tostring(abstention_votes)
    44           }
    45           ui.tag { tag = "th", content = _"Abstention" }
    46           ui.tag { tag = "td", content =
    47             format.percent_floor(abstention_votes, max_value) 
    48           }
    49           ui.tag { tag = "th", content = _"Abstention" }
    50         end }
    51         ui.tag { tag = "tr", attr = { class = "no" }, content = function ()
    52           ui.tag { tag = "td", content = 
    53             tostring(negative_votes)
    54           }
    55           ui.tag { tag = "th", content = _"No" }
    56           ui.tag { tag = "td", content =
    57             format.percent_floor(negative_votes, max_value) 
    58           }
    59           ui.tag { tag = "th", content = _"No" }
    60         end }
    61       end }
    62     end
    63   }
    64 end
    66 -- initiative not admitted info
    67 if initiative.admitted == false then
    68   local policy = initiative.issue.policy
    69   ui.container{
    70     attr = { class = "sectionRow not_admitted_info" },
    71     content = function ()
    72       ui.heading { level = 1, content = _"Initiative not admitted" }
    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 ) } ) }
    74     end
    75   }
    76 end
    78 -- initiative revoked info
    79 if initiative.revoked then
    80   ui.container{
    81     attr = { class = "sectionRow revoked_info" },
    82     content = function()
    83       ui.heading { level = 1, content = _"Initiative revoked" }
    84       slot.put(_("This initiative has been revoked at #{revoked} by:", {
    85         revoked = format.timestamp(initiative.revoked)
    86       }))
    87       slot.put(" ")
    88       if app.session:has_access("authors_pseudonymous") then
    89         ui.link{
    90           module = "member", view = "show", id = initiative.revoked_by_member_id,
    91           content = initiative.revoked_by_member.name
    92         }
    93       else
    94         ui.tag{ content = _"[Not public]" }
    95       end
    96       local suggested_initiative = initiative.suggested_initiative
    97       if suggested_initiative then
    98         slot.put("<br /><br />")
    99         slot.put(_("The initiators suggest to support the following initiative:"))
   100         slot.put("<br />")
   101         ui.link{
   102           content = suggested_initiative.display_name,
   103           module = "initiative",
   104           view = "show",
   105           id = suggested_initiative.id
   106         }
   107       end
   108     end
   109   }
   110 end
