liquid_feedback_frontend
changeset 64:3ec1dea6eefb
Bug when creating alternative initiatives fixed; Policy list link only shown when creating new issue
author | bsw |
---|---|
date | Thu Apr 22 17:05:18 2010 +0200 (2010-04-22) |
parents | 32a814f8b496 |
children | d63d32c9fb37 |
files | app/main/initiative/_action/create.lua app/main/initiative/new.lua |
line diff
1.1 --- a/app/main/initiative/_action/create.lua Thu Apr 22 16:29:07 2010 +0200 1.2 +++ b/app/main/initiative/_action/create.lua Thu Apr 22 17:05:18 2010 +0200 1.3 @@ -33,19 +33,7 @@ 1.4 end 1.5 end 1.6 1.7 -local policy_id = param.get("policy_id", atom.integer) 1.8 1.9 -if policy_id == -1 then 1.10 - slot.put_into("error", _"Please choose a policy") 1.11 - return false 1.12 -end 1.13 - 1.14 -local policy = Policy:by_id(policy_id) 1.15 - 1.16 -if not policy.active then 1.17 - slot.put_into("error", "Invalid policy.") 1.18 - return false 1.19 -end 1.20 1.21 local name = param.get("name") 1.22 1.23 @@ -59,6 +47,16 @@ 1.24 local initiative = Initiative:new() 1.25 1.26 if not issue then 1.27 + local policy_id = param.get("policy_id", atom.integer) 1.28 + if policy_id == -1 then 1.29 + slot.put_into("error", _"Please choose a policy") 1.30 + return false 1.31 + end 1.32 + local policy = Policy:by_id(policy_id) 1.33 + if not policy.active then 1.34 + slot.put_into("error", "Invalid policy.") 1.35 + return false 1.36 + end 1.37 if not area:get_reference_selector("allowed_policies") 1.38 :add_where{ "policy.id = ?", policy_id } 1.39 :optional_object_mode()
2.1 --- a/app/main/initiative/new.lua Thu Apr 22 16:29:07 2010 +0200 2.2 +++ b/app/main/initiative/new.lua Thu Apr 22 17:05:18 2010 +0200 2.3 @@ -43,33 +43,33 @@ 2.4 foreign_name = "name", 2.5 value = (area.default_policy or {}).id 2.6 } 2.7 + ui.tag{ 2.8 + tag = "div", 2.9 + content = function() 2.10 + ui.tag{ 2.11 + tag = "label", 2.12 + attr = { class = "ui_field_label" }, 2.13 + content = function() slot.put(" ") end, 2.14 + } 2.15 + ui.tag{ 2.16 + content = function() 2.17 + ui.link{ 2.18 + text = _"Information about the available policies", 2.19 + module = "policy", 2.20 + view = "list" 2.21 + } 2.22 + slot.put(" ") 2.23 + ui.link{ 2.24 + attr = { target = "_blank" }, 2.25 + text = _"(new window)", 2.26 + module = "policy", 2.27 + view = "list" 2.28 + } 2.29 + end 2.30 + } 2.31 + end 2.32 + } 2.33 end 2.34 - ui.tag{ 2.35 - tag = "div", 2.36 - content = function() 2.37 - ui.tag{ 2.38 - tag = "label", 2.39 - attr = { class = "ui_field_label" }, 2.40 - content = function() slot.put(" ") end, 2.41 - } 2.42 - ui.tag{ 2.43 - content = function() 2.44 - ui.link{ 2.45 - text = _"Information about the available policies", 2.46 - module = "policy", 2.47 - view = "list" 2.48 - } 2.49 - slot.put(" ") 2.50 - ui.link{ 2.51 - attr = { target = "_blank" }, 2.52 - text = _"(new window)", 2.53 - module = "policy", 2.54 - view = "list" 2.55 - } 2.56 - end 2.57 - } 2.58 - end 2.59 - } 2.60 slot.put("<br />") 2.61 ui.field.text{ label = _"Title of initiative", name = "name" } 2.62 ui.field.text{ label = _"Discussion URL", name = "discussion_url" }