liquid_feedback_frontend

view app/main/policy/list.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 c85f17285a94
children eb16d41929bd
line source
1 ui.title(_"Policies")
3 util.help("policy.list", _"Policies")
4 local policies = Policy:new_selector()
5 :add_where("active")
6 :add_order_by("index")
7 :exec()
9 ui.list{
10 records = policies,
11 columns = {
12 {
13 label_attr = { width = "500" },
14 label = _"Policy",
15 content = function(policy)
16 ui.link{
17 module = "policy", view = "show", id = policy.id,
18 attr = { style = "font-weight: bold" },
19 content = function()
20 slot.put(encode.html(policy.name))
21 if not policy.active then
22 slot.put(" (", _"disabled", ")")
23 end
24 end
25 }
26 ui.tag{
27 tag = "div",
28 content = policy.description
29 }
30 end
31 },
32 {
33 label_attr = { width = "200" },
34 label = _"Phases",
35 content = function(policy)
36 if policy.polling then
37 ui.field.text{ label = _"New" .. ":", value = _"without" }
38 else
39 ui.field.text{ label = _"New" .. ":", value = "≤ " .. policy.admission_time }
40 end
41 ui.field.text{ label = _"Discussion" .. ":", value = policy.discussion_time }
42 ui.field.text{ label = _"Frozen" .. ":", value = policy.verification_time }
43 ui.field.text{ label = _"Voting" .. ":", value = policy.voting_time }
44 end
45 },
46 {
47 label_attr = { width = "200" },
48 label = _"Quorum",
49 content = function(policy)
50 if policy.polling then
51 ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" }
52 else
53 ui.field.text{
54 label = _"Issue quorum" .. ":",
55 value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den)
56 }
57 end
58 ui.field.text{
59 label = _"Initiative quorum" .. ":",
60 value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den)
61 }
62 ui.field.text{
63 label = _"Direct majority" .. ":",
64 value = (policy.direct_majority_strict and ">" or "≥" ) .. " " .. tostring(policy.direct_majority_num) .. "/" .. tostring(policy.direct_majority_den)
65 }
66 ui.field.text{
67 label = _"Indirect majority" .. ":",
68 value = (policy.indirect_majority_strict and ">" or "≥" ) .. " " .. tostring(policy.indirect_majority_num) .. "/" .. tostring(policy.indirect_majority_den)
69 }
70 end
71 },
72 }
73 }

Impressum / About Us