liquid_feedback_frontend
diff app/main/initiative/new.lua @ 904:a176129ce282
Add support for poll mode; Forbid postings unless contingents are configured
author | bsw |
---|---|
date | Sun Aug 26 22:37:49 2012 +0200 (2012-08-26) |
parents | dd6c00eb215f |
children | 319161d5a904 |
line diff
1.1 --- a/app/main/initiative/new.lua Tue Aug 21 01:29:28 2012 +0200 1.2 +++ b/app/main/initiative/new.lua Sun Aug 26 22:37:49 2012 +0200 1.3 @@ -11,6 +11,8 @@ 1.4 area = Area:new_selector():add_where{"id=?",area_id}:single_object_mode():exec() 1.5 end 1.6 1.7 +local polling = param.get("polling", atom.boolean) 1.8 + 1.9 local policy_id = param.get("policy_id", atom.integer) 1.10 local policy 1.11 1.12 @@ -62,7 +64,7 @@ 1.13 slot.put("<br />") 1.14 if issue_id then 1.15 ui.field.text{ label = _"Issue", value = issue_id } 1.16 - elseif policy_id then 1.17 + elseif policy then 1.18 ui.field.hidden{ name = "policy_id", value = policy.id } 1.19 ui.field.text{ label = _"Policy", value = policy.name } 1.20 if policy.free_timeable then 1.21 @@ -89,7 +91,7 @@ 1.22 else 1.23 tmp = { { id = -1, name = _"Please choose a policy" } } 1.24 for i, allowed_policy in ipairs(area.allowed_policies) do 1.25 - if not allowed_policy.polling or app.session.member:has_polling_right_for_unit_id(area.unit_id) then 1.26 + if not allowed_policy.polling then 1.27 tmp[#tmp+1] = allowed_policy 1.28 end 1.29 end 1.30 @@ -130,7 +132,7 @@ 1.31 end 1.32 1.33 if issue and issue.policy.polling and app.session.member:has_polling_right_for_unit_id(area.unit_id) then 1.34 - ui.field.boolean{ name = "polling", label = _"Poll" } 1.35 + ui.field.boolean{ name = "polling", label = _"Poll", value = polling } 1.36 end 1.37 1.38 if preview then