liquid_feedback_frontend

view app/main/policy/show.lua @ 900:832c8d0f3c7e

Handle policies without issue quorum in policy views correctly
author bsw
date Tue Aug 21 00:33:17 2012 +0200 (2012-08-21)
parents c587d8762e62
children eb16d41929bd
line source
1 local policy = Policy:by_id(param.get_id())
3 slot.put_into("title", encode.html(_("Policy '#{name}'", { name = policy.name })))
5 ui.form{
6 attr = { class = "vertical" },
7 record = policy,
8 content = function()
9 if policy.polling then
10 ui.field.text{ label = _"New" .. ":", value = _"without" }
11 else
12 ui.field.text{ label = _"New" .. ":", value = "≤ " .. policy.admission_time }
13 end
14 ui.field.text{ label = _"Discussion", value = policy.discussion_time }
15 ui.field.text{ label = _"Frozen", value = policy.verification_time }
16 ui.field.text{ label = _"Voting", value = policy.voting_time }
18 if policy.polling then
19 ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" }
20 else
21 ui.field.text{
22 label = _"Issue quorum",
23 value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den)
24 }
25 end
26 ui.field.text{
27 label = _"Initiative quorum",
28 value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den)
29 }
30 ui.field.text{
31 label = _"Direct majority",
32 value =
33 (policy.direct_majority_strict and ">" or "≥" ) .. " "
34 .. tostring(policy.direct_majority_num) .. "/"
35 .. tostring(policy.direct_majority_den)
36 .. (policy.direct_majority_positive > 1 and ", " .. _("at least #{count} approvals", { count = policy.direct_majority_positive }) or "")
37 .. (policy.direct_majority_non_negative > 1 and ", " .. _("at least #{count} approvals or abstentions", { count = policy.direct_majority_non_negative }) or "")
38 }
40 ui.field.text{
41 label = _"Indirect majority",
42 value =
43 (policy.indirect_majority_strict and ">" or "≥" ) .. " "
44 .. tostring(policy.indirect_majority_num) .. "/"
45 .. tostring(policy.indirect_majority_den)
46 .. (policy.indirect_majority_positive > 1 and ", " .. _("at least #{count} approvals", { count = policy.indirect_majority_positive }) or "")
47 .. (policy.indirect_majority_non_negative > 1 and ", " .. _("at least #{count} approvals or abstentions", { count = policy.indirect_majority_non_negative }) or "")
48 }
50 local texts = {}
51 if policy.no_reverse_beat_path then
52 texts[#texts+1] = _"no reverse beat path to status quo (including ties)"
53 end
54 if policy.no_multistage_majority then
55 texts[#texts+1] = _"prohibit potentially instable results caused by multistage majorities"
56 end
57 ui.field.text{
58 label = _"Options",
59 value = table.concat(texts, ", ")
60 }
61 if policy.description and #policy.description > 0 then
62 ui.container{
63 attr = { class = "suggestion_content wiki" },
64 content = function()
65 ui.tag{
66 tag = "p",
67 content = policy.description
68 }
69 end
70 }
71 end
73 end
74 }

Impressum / About Us