liquid_feedback_frontend
view app/main/report/initiative.lua @ 172:165f4bd02cf3
don't show the first draft of a new initiative as a new draft event in the timeline
new draft should only show changes of drafts drafts of new initiatives as they are handled by the new initiative event
new draft should only show changes of drafts drafts of new initiatives as they are handled by the new initiative event
| author | Daniel Poelzleithner <poelzi@poelzi.org> | 
|---|---|
| date | Sun Oct 10 19:40:32 2010 +0200 (2010-10-10) | 
| parents | a6caaff47205 | 
| children | 
 line source
     1 local initiative = param.get("initiative", "table")
     3 link_area(initiative.issue.area)
     5 link_issue(initiative.issue)
     7 ui.link{
     8   external = "",
     9   attr = {
    10     style = "display: block; text-decoration: none;",
    11     name = "initiative_" .. tostring(initiative.id),
    12   },
    13   content = function()
    14     ui.heading{
    15       content = _("##{issue_id}.#{id} #{name}", { issue_id = initiative.issue.id, id = initiative.id, name = initiative.shortened_name })
    16     }
    17   end
    18 }
    20 slot.put("<br />")
    22 if initiative.issue.ranks_available and initiative.admitted then
    23   local class = initiative.rank == 1 and "admitted_info" or "not_admitted_info"
    24   ui.container{
    25     attr = { class = class },
    26     content = function()
    27       local max_value = initiative.issue.voter_count
    28       slot.put(" ")
    29       local positive_votes = initiative.positive_votes
    30       local negative_votes = initiative.negative_votes
    31       slot.put(_"Yes" .. ": <b>" .. tostring(positive_votes) .. "</b>")
    32       slot.put(" · ")
    33       slot.put(_"Abstention" .. ": <b>" .. tostring(max_value - initiative.negative_votes - initiative.positive_votes)  .. "</b>")
    34       slot.put(" · ")
    35       slot.put(_"No" .. ": <b>" .. tostring(initiative.negative_votes) .. "</b>")
    36       slot.put(" · ")
    37       slot.put("<b>")
    38       if initiative.rank == 1 then
    39         slot.put(_"Approved")
    40       elseif initiative.rank then
    41         slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank }))
    42       else
    43         slot.put(_"Not approved")
    44       end
    45       slot.put("</b>")
    46     end
    47   }
    48 end
    50 if initiative.issue.state == "cancelled" then
    51   local policy = initiative.issue.policy
    52   ui.container{
    53     attr = { class = "not_admitted_info" },
    54     content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) })
    55   }
    56 elseif initiative.admitted == false then
    57   local policy = initiative.issue.policy
    58   ui.container{
    59     attr = { class = "not_admitted_info" },
    60     content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) })
    61   }
    62 end
    64 if initiative.revoked then
    65   ui.container{
    66     attr = { class = "revoked_info" },
    67     content = function()
    68       slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) }))
    69     end
    70   }
    71 end
    74 ui.container{
    75   attr = { class = "draft_content wiki" },
    76   content = function()
    77     slot.put(format.wiki_text(initiative.current_draft.content, initiative.current_draft.formatting_engine))
    78   end
    79 }
    81 execute.view{
    82   module = "initiative",
    83   view = "_battles",
    84   params = { initiative = initiative }
    85 }
