liquid_feedback_frontend

annotate app/main/policy/_list.lua @ 1283:37359fcc2bd9

Layout issue fixed
author bsw
date Mon Apr 18 09:49:05 2016 +0200 (2016-04-18)
parents 8288027edb54
children 32cc544d5a5b
rev   line source
bsw@1045 1 local for_area = param.get("for_area", "table")
bsw@1045 2
bsw@1045 3 local selector = Policy:new_selector()
bsw@1045 4 :add_where("policy.active")
bsw@1045 5 :add_order_by("policy.index")
bsw@1045 6
bsw@1045 7 if for_area then
bsw@1045 8 selector:join("allowed_policy", nil,
bsw@1045 9 { "allowed_policy.policy_id = policy.id AND allowed_policy.area_id = ?", for_area.id }
bsw@1045 10 )
bsw@1045 11 end
bsw@1045 12
bsw@1045 13 local policies = selector:exec()
bsw@1045 14
bsw@1045 15
bsw@1045 16 for i, policy in ipairs(policies) do
bsw@1045 17 ui.container {
bsw@1045 18 attr = { class = "sidebarRow", id = "policy" .. policy.id },
bsw@1045 19 content = function ()
bsw@1045 20
bsw@1045 21 ui.heading { level = 3, content = policy.name }
bsw@1045 22
bsw@1045 23 ui.tag{
bsw@1045 24 content = policy.description
bsw@1045 25 }
bsw@1045 26
bsw@1045 27 slot.put ( "<br />" )
bsw@1045 28
bsw@1045 29 ui.link {
bsw@1045 30 attr = {
bsw@1045 31 class = "policy-show-details",
bsw@1045 32 onclick = "$('#policy" .. policy.id .. " .policy-details').show(); $('#policy" .. policy.id .. " .policy-show-details').hide(); $('#policy" .. policy.id .. " .policy-hide-details').show(); return false;"
bsw@1045 33 },
bsw@1045 34 content = _"show details"
bsw@1045 35 }
bsw@1045 36
bsw@1045 37 ui.link {
bsw@1045 38 attr = {
bsw@1045 39 class = "policy-hide-details",
bsw@1045 40 onclick = "$('#policy" .. policy.id .. " .policy-details').hide(); $('#policy" .. policy.id .. " .policy-show-details').show(); $('#policy" .. policy.id .. " .policy-hide-details').hide(); return false;",
bsw@1045 41 style = "display: none;"
bsw@1045 42 },
bsw@1045 43 content = _"hide details"
bsw@1045 44 }
bsw@1045 45
bsw@1045 46 ui.container {
bsw@1045 47 attr = {
bsw@1045 48 class = "policy-details",
bsw@1045 49 style = "display: none;"
bsw@1045 50 },
bsw@1045 51 content = function ()
bsw@1045 52
bsw@1045 53 ui.heading { level = 4, content = _"Phase durations" }
bsw@1045 54
bsw@1045 55 if policy.polling then
bsw@1045 56 ui.field.text{ label = _"New" .. ":", value = _"without" }
bsw@1045 57 else
bsw@1234 58 ui.field.text{ label = _"New" .. ":", value = "≤ min " .. format.interval_text(policy.max_admission_time) }
bsw@1234 59 ui.field.text{ label = _"New" .. ":", value = "≤ max " .. format.interval_text(policy.max_admission_time) }
bsw@1045 60 end
bsw@1100 61 ui.field.text{ label = _"Discussion" .. ":", value = format.interval_text(policy.discussion_time) or _"variable" }
bsw@1100 62 ui.field.text{ label = _"Frozen" .. ":", value = format.interval_text(policy.verification_time) or _"variable" }
bsw@1100 63 ui.field.text{ label = _"Voting" .. ":", value = format.interval_text(policy.voting_time) or _"variable" }
bsw@1045 64
bsw@1045 65 ui.heading { level = 4, content = _"Quorums" }
bsw@1045 66
bsw@1045 67 if policy.polling then
bsw@1045 68 ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" }
bsw@1045 69 else
bsw@1045 70 ui.field.text{
bsw@1045 71 label = _"Issue quorum" .. ":",
bsw@1045 72 value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den)
bsw@1045 73 }
bsw@1045 74 end
bsw@1045 75 ui.field.text{
bsw@1045 76 label = _"Initiative quorum" .. ":",
bsw@1045 77 value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den)
bsw@1045 78 }
bsw@1045 79 ui.field.text{
bsw@1045 80 label = _"Direct majority" .. ":",
bsw@1045 81 value = (policy.direct_majority_strict and ">" or "≥" ) .. " " .. tostring(policy.direct_majority_num) .. "/" .. tostring(policy.direct_majority_den)
bsw@1045 82 }
bsw@1045 83 ui.field.text{
bsw@1045 84 label = _"Indirect majority" .. ":",
bsw@1045 85 value = (policy.indirect_majority_strict and ">" or "≥" ) .. " " .. tostring(policy.indirect_majority_num) .. "/" .. tostring(policy.indirect_majority_den)
bsw@1045 86 }
bsw@1045 87 end
bsw@1045 88 }
bsw@1045 89 end
bsw@1045 90 }
bsw@1045 91 end

Impressum / About Us