# HG changeset patch # User bsw # Date 1271948718 -7200 # Node ID 3ec1dea6eefbabbdfc440fcf97240e8e83bb4b69 # Parent 32a814f8b496a8b97126c8eb3e3a6c21afb809b3 Bug when creating alternative initiatives fixed; Policy list link only shown when creating new issue diff -r 32a814f8b496 -r 3ec1dea6eefb app/main/initiative/_action/create.lua --- a/app/main/initiative/_action/create.lua Thu Apr 22 16:29:07 2010 +0200 +++ b/app/main/initiative/_action/create.lua Thu Apr 22 17:05:18 2010 +0200 @@ -33,19 +33,7 @@ end end -local policy_id = param.get("policy_id", atom.integer) -if policy_id == -1 then - slot.put_into("error", _"Please choose a policy") - return false -end - -local policy = Policy:by_id(policy_id) - -if not policy.active then - slot.put_into("error", "Invalid policy.") - return false -end local name = param.get("name") @@ -59,6 +47,16 @@ local initiative = Initiative:new() if not issue then + local policy_id = param.get("policy_id", atom.integer) + if policy_id == -1 then + slot.put_into("error", _"Please choose a policy") + return false + end + local policy = Policy:by_id(policy_id) + if not policy.active then + slot.put_into("error", "Invalid policy.") + return false + end if not area:get_reference_selector("allowed_policies") :add_where{ "policy.id = ?", policy_id } :optional_object_mode() diff -r 32a814f8b496 -r 3ec1dea6eefb app/main/initiative/new.lua --- a/app/main/initiative/new.lua Thu Apr 22 16:29:07 2010 +0200 +++ b/app/main/initiative/new.lua Thu Apr 22 17:05:18 2010 +0200 @@ -43,33 +43,33 @@ foreign_name = "name", value = (area.default_policy or {}).id } + ui.tag{ + tag = "div", + content = function() + ui.tag{ + tag = "label", + attr = { class = "ui_field_label" }, + content = function() slot.put(" ") end, + } + ui.tag{ + content = function() + ui.link{ + text = _"Information about the available policies", + module = "policy", + view = "list" + } + slot.put(" ") + ui.link{ + attr = { target = "_blank" }, + text = _"(new window)", + module = "policy", + view = "list" + } + end + } + end + } end - ui.tag{ - tag = "div", - content = function() - ui.tag{ - tag = "label", - attr = { class = "ui_field_label" }, - content = function() slot.put(" ") end, - } - ui.tag{ - content = function() - ui.link{ - text = _"Information about the available policies", - module = "policy", - view = "list" - } - slot.put(" ") - ui.link{ - attr = { target = "_blank" }, - text = _"(new window)", - module = "policy", - view = "list" - } - end - } - end - } slot.put("
") ui.field.text{ label = _"Title of initiative", name = "name" } ui.field.text{ label = _"Discussion URL", name = "discussion_url" }