liquid_feedback_frontend
changeset 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 | ad1e31e13ff6 |
children | f3d6d08b0125 |
files | app/main/policy/list.lua app/main/policy/show.lua |
line diff
1.1 --- a/app/main/policy/list.lua Tue Aug 21 00:25:57 2012 +0200 1.2 +++ b/app/main/policy/list.lua Tue Aug 21 00:33:17 2012 +0200 1.3 @@ -33,7 +33,11 @@ 1.4 label_attr = { width = "200" }, 1.5 label = _"Phases", 1.6 content = function(policy) 1.7 - ui.field.text{ label = _"New" .. ":", value = "≤ " .. policy.admission_time } 1.8 + if policy.polling then 1.9 + ui.field.text{ label = _"New" .. ":", value = _"without" } 1.10 + else 1.11 + ui.field.text{ label = _"New" .. ":", value = "≤ " .. policy.admission_time } 1.12 + end 1.13 ui.field.text{ label = _"Discussion" .. ":", value = policy.discussion_time } 1.14 ui.field.text{ label = _"Frozen" .. ":", value = policy.verification_time } 1.15 ui.field.text{ label = _"Voting" .. ":", value = policy.voting_time } 1.16 @@ -43,10 +47,14 @@ 1.17 label_attr = { width = "200" }, 1.18 label = _"Quorum", 1.19 content = function(policy) 1.20 - ui.field.text{ 1.21 - label = _"Issue quorum" .. ":", 1.22 - value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den) 1.23 - } 1.24 + if policy.polling then 1.25 + ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" } 1.26 + else 1.27 + ui.field.text{ 1.28 + label = _"Issue quorum" .. ":", 1.29 + value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den) 1.30 + } 1.31 + end 1.32 ui.field.text{ 1.33 label = _"Initiative quorum" .. ":", 1.34 value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den)
2.1 --- a/app/main/policy/show.lua Tue Aug 21 00:25:57 2012 +0200 2.2 +++ b/app/main/policy/show.lua Tue Aug 21 00:33:17 2012 +0200 2.3 @@ -6,17 +6,23 @@ 2.4 attr = { class = "vertical" }, 2.5 record = policy, 2.6 content = function() 2.7 - ui.field.text{ label = _"Name", value = policy.name } 2.8 - 2.9 - ui.field.text{ label = _"New", value = "≤ " .. policy.admission_time } 2.10 + if policy.polling then 2.11 + ui.field.text{ label = _"New" .. ":", value = _"without" } 2.12 + else 2.13 + ui.field.text{ label = _"New" .. ":", value = "≤ " .. policy.admission_time } 2.14 + end 2.15 ui.field.text{ label = _"Discussion", value = policy.discussion_time } 2.16 ui.field.text{ label = _"Frozen", value = policy.verification_time } 2.17 ui.field.text{ label = _"Voting", value = policy.voting_time } 2.18 2.19 - ui.field.text{ 2.20 - label = _"Issue quorum", 2.21 - value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den) 2.22 - } 2.23 + if policy.polling then 2.24 + ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" } 2.25 + else 2.26 + ui.field.text{ 2.27 + label = _"Issue quorum", 2.28 + value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den) 2.29 + } 2.30 + end 2.31 ui.field.text{ 2.32 label = _"Initiative quorum", 2.33 value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den) 2.34 @@ -52,15 +58,17 @@ 2.35 label = _"Options", 2.36 value = table.concat(texts, ", ") 2.37 } 2.38 - ui.container{ 2.39 - attr = { class = "suggestion_content wiki" }, 2.40 - content = function() 2.41 - ui.tag{ 2.42 - tag = "p", 2.43 - content = policy.description 2.44 - } 2.45 - end 2.46 - } 2.47 + if policy.description and #policy.description > 0 then 2.48 + ui.container{ 2.49 + attr = { class = "suggestion_content wiki" }, 2.50 + content = function() 2.51 + ui.tag{ 2.52 + tag = "p", 2.53 + content = policy.description 2.54 + } 2.55 + end 2.56 + } 2.57 + end 2.58 2.59 end 2.60 }