# HG changeset patch # User bsw # Date 1345501997 -7200 # Node ID 832c8d0f3c7ee871b877f60d439e4e03be56b0aa # Parent ad1e31e13ff68720580c01558143726441912e89 Handle policies without issue quorum in policy views correctly diff -r ad1e31e13ff6 -r 832c8d0f3c7e app/main/policy/list.lua --- a/app/main/policy/list.lua Tue Aug 21 00:25:57 2012 +0200 +++ b/app/main/policy/list.lua Tue Aug 21 00:33:17 2012 +0200 @@ -33,7 +33,11 @@ label_attr = { width = "200" }, label = _"Phases", content = function(policy) - ui.field.text{ label = _"New" .. ":", value = "≤ " .. policy.admission_time } + if policy.polling then + ui.field.text{ label = _"New" .. ":", value = _"without" } + else + ui.field.text{ label = _"New" .. ":", value = "≤ " .. policy.admission_time } + end ui.field.text{ label = _"Discussion" .. ":", value = policy.discussion_time } ui.field.text{ label = _"Frozen" .. ":", value = policy.verification_time } ui.field.text{ label = _"Voting" .. ":", value = policy.voting_time } @@ -43,10 +47,14 @@ label_attr = { width = "200" }, label = _"Quorum", content = function(policy) - ui.field.text{ - label = _"Issue quorum" .. ":", - value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den) - } + if policy.polling then + ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" } + else + ui.field.text{ + label = _"Issue quorum" .. ":", + value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den) + } + end ui.field.text{ label = _"Initiative quorum" .. ":", value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den) diff -r ad1e31e13ff6 -r 832c8d0f3c7e app/main/policy/show.lua --- a/app/main/policy/show.lua Tue Aug 21 00:25:57 2012 +0200 +++ b/app/main/policy/show.lua Tue Aug 21 00:33:17 2012 +0200 @@ -6,17 +6,23 @@ attr = { class = "vertical" }, record = policy, content = function() - ui.field.text{ label = _"Name", value = policy.name } - - ui.field.text{ label = _"New", value = "≤ " .. policy.admission_time } + if policy.polling then + ui.field.text{ label = _"New" .. ":", value = _"without" } + else + ui.field.text{ label = _"New" .. ":", value = "≤ " .. policy.admission_time } + end ui.field.text{ label = _"Discussion", value = policy.discussion_time } ui.field.text{ label = _"Frozen", value = policy.verification_time } ui.field.text{ label = _"Voting", value = policy.voting_time } - ui.field.text{ - label = _"Issue quorum", - value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den) - } + if policy.polling then + ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" } + else + ui.field.text{ + label = _"Issue quorum", + value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den) + } + end ui.field.text{ label = _"Initiative quorum", value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den) @@ -52,15 +58,17 @@ label = _"Options", value = table.concat(texts, ", ") } - ui.container{ - attr = { class = "suggestion_content wiki" }, - content = function() - ui.tag{ - tag = "p", - content = policy.description - } - end - } + if policy.description and #policy.description > 0 then + ui.container{ + attr = { class = "suggestion_content wiki" }, + content = function() + ui.tag{ + tag = "p", + content = policy.description + } + end + } + end end }