# HG changeset patch # User bsw # Date 1262430000 -3600 # Node ID 3941792e8be6af717b105ae12ae07c7892536089 # Parent 8d91bccab0bf09588155ed63a964e9525efd701b Version beta3 Table allowed_policy is respected while creating new issues Broken vote now/later link is not shown anymore (until it's implemented) More user friendly error page Minor spelling error corrected diff -r 8d91bccab0bf -r 3941792e8be6 app/main/_layout/system_error.html --- a/app/main/_layout/system_error.html Sat Jan 02 12:00:00 2010 +0100 +++ b/app/main/_layout/system_error.html Sat Jan 02 12:00:00 2010 +0100 @@ -3,39 +3,73 @@ Liquid Democracy System Error - + -
-
-
-
-
- System message -
-
-
-
-   -
-
-
- -
-
-
-
- - index -
-
+ +
+ + Ooops, a system error occured +
+

+ Most probably you found a software bug. Don't panic, you can now choose one of the following options: +

+ + Go to start page + Retry request + Create bug report + +
+ +
+ + Leider ist ein Systemfehler aufgetreten
-
- -
- -
close
-
-
+

+ Du hast vermutlich gerade einen Fehler in der Software entdeckt. Das ist kein Grund zur Panik, dir bleiben die folgenden Optionen: +

+ + Weiter zur Startseite + Anfrage wiederholen + Fehlerbericht erstellen + +
+

+ If you write a bug report, please include the following output in your bug report.
+ Falls Du einen Fehlerbericht erstellst, füge bitte die folgenden Ausgaben mit ein. +

+ + + +
+ +
+ +
close
+
+ \ No newline at end of file diff -r 8d91bccab0bf -r 3941792e8be6 app/main/initiative/_action/create.lua --- a/app/main/initiative/_action/create.lua Sat Jan 02 12:00:00 2010 +0100 +++ b/app/main/initiative/_action/create.lua Sat Jan 02 12:00:00 2010 +0100 @@ -41,9 +41,17 @@ local initiative = Initiative:new() if not issue then + local policy_id = param.get("policy_id", atom.integer) + if not area:get_reference_selector("allowed_policies") + :add_where{ "policy.id = ?", policy_id } + :optional_object_mode() + :exec() + then + error("policy not allowed") + end issue = Issue:new() issue.area_id = area.id - issue.policy_id = param.get("policy_id", atom.integer) + issue.policy_id = policy_id issue:save() end diff -r 8d91bccab0bf -r 3941792e8be6 app/main/initiative/new.lua --- a/app/main/initiative/new.lua Sat Jan 02 12:00:00 2010 +0100 +++ b/app/main/initiative/new.lua Sat Jan 02 12:00:00 2010 +0100 @@ -30,12 +30,14 @@ if issue_id then ui.field.text{ label = _"Issue", value = issue_id } else + local value ui.field.select{ label = _"Policy", name = "policy_id", - foreign_records = Policy:new_selector():add_order_by("index"):exec(), + foreign_records = area.allowed_policies, foreign_id = "id", - foreign_name = "name" + foreign_name = "name", + value = area.default_policy.id } end ui.field.text{ label = _"Name", name = "name" } diff -r 8d91bccab0bf -r 3941792e8be6 app/main/issue/_show_head.lua --- a/app/main/issue/_show_head.lua Sat Jan 02 12:00:00 2010 +0100 +++ b/app/main/issue/_show_head.lua Sat Jan 02 12:00:00 2010 +0100 @@ -64,7 +64,8 @@ params = { issue_id = issue.id } } end - + +--[[ if issue.state == "accepted" then -- TODO ui.link{ @@ -74,6 +75,7 @@ end, } end +--]] end) diff -r 8d91bccab0bf -r 3941792e8be6 config/default.lua --- a/config/default.lua Sat Jan 02 12:00:00 2010 +0100 +++ b/config/default.lua Sat Jan 02 12:00:00 2010 +0100 @@ -1,5 +1,5 @@ config.app_name = "LiquidFeedback" -config.app_version = "beta2" +config.app_version = "beta3" config.app_title = config.app_name .. " (" .. request.get_config_name() .. " environment)" diff -r 8d91bccab0bf -r 3941792e8be6 locale/translations.de.lua --- a/locale/translations.de.lua Sat Jan 02 12:00:00 2010 +0100 +++ b/locale/translations.de.lua Sat Jan 02 12:00:00 2010 +0100 @@ -297,7 +297,7 @@ ["Supporter"] = "Unterstützer"; ["Terms accepted"] = "Bedingungen akzeptiert"; ["That's me!"] = "Das bin ich"; -["The code you've entered is invalid"] = "Den Code den Du eingeben hast ist nicht gültig!"; +["The code you've entered is invalid"] = "Der Code, den Du eingeben hast, ist nicht gültig!"; ["The drafts do not differ"] = "Die Entwürfe unterscheiden sich nicht"; ["This issue is already closed."] = "Das Thema ist schon geschlossen."; ["This issue is already frozen."] = "Das Thema ist schon eingefroren"; diff -r 8d91bccab0bf -r 3941792e8be6 model/area.lua --- a/model/area.lua Sat Jan 02 12:00:00 2010 +0100 +++ b/model/area.lua Sat Jan 02 12:00:00 2010 +0100 @@ -38,3 +38,23 @@ connected_by_that_key = 'member_id', ref = 'members' } + +Area:add_reference{ + mode = 'mm', + to = "Policy", + this_key = 'id', + that_key = 'id', + connected_by_table = 'allowed_policy', + connected_by_this_key = 'area_id', + connected_by_that_key = 'policy_id', + ref = 'allowed_policies' +} + +function Area.object_get:default_policy() + return Policy:new_selector() + :join("allowed_policy", nil, "allowed_policy.policy_id = policy.id") + :add_where{ "allowed_policy.area_id = ? AND allowed_policy.default_policy", self.id } + :single_object_mode() + :exec() +end +