liquid_feedback_frontend

view app/main/initiative/new.lua @ 90:8183cc841c00

Added tag beta25 for changeset d68d16371b88
author bsw
date Thu Aug 05 11:56:44 2010 +0200 (2010-08-05)
parents 3ec1dea6eefb
children 6a12fb7e4963
line source
1 local issue
2 local area
4 local issue_id = param.get("issue_id", atom.integer)
5 if issue_id then
6 issue = Issue:new_selector():add_where{"id=?",issue_id}:single_object_mode():exec()
7 area = issue.area
9 else
10 local area_id = param.get("area_id", atom.integer)
11 area = Area:new_selector():add_where{"id=?",area_id}:single_object_mode():exec()
12 end
14 if issue_id then
15 slot.put_into("title", _"Add alternative initiative to issue")
16 else
17 slot.put_into("title", _"Create new issue")
18 end
20 ui.form{
21 module = "initiative",
22 action = "create",
23 params = {
24 area_id = area.id,
25 issue_id = issue and issue.id or nil
26 },
27 attr = { class = "vertical" },
28 content = function()
29 ui.field.text{ label = _"Area", value = area.name }
30 slot.put("<br />")
31 if issue_id then
32 ui.field.text{ label = _"Issue", value = issue_id }
33 else
34 tmp = { { id = -1, name = _"Please choose a policy" } }
35 for i, allowed_policy in ipairs(area.allowed_policies) do
36 tmp[#tmp+1] = allowed_policy
37 end
38 ui.field.select{
39 label = _"Policy",
40 name = "policy_id",
41 foreign_records = tmp,
42 foreign_id = "id",
43 foreign_name = "name",
44 value = (area.default_policy or {}).id
45 }
46 ui.tag{
47 tag = "div",
48 content = function()
49 ui.tag{
50 tag = "label",
51 attr = { class = "ui_field_label" },
52 content = function() slot.put("&nbsp;") end,
53 }
54 ui.tag{
55 content = function()
56 ui.link{
57 text = _"Information about the available policies",
58 module = "policy",
59 view = "list"
60 }
61 slot.put(" ")
62 ui.link{
63 attr = { target = "_blank" },
64 text = _"(new window)",
65 module = "policy",
66 view = "list"
67 }
68 end
69 }
70 end
71 }
72 end
73 slot.put("<br />")
74 ui.field.text{ label = _"Title of initiative", name = "name" }
75 ui.field.text{ label = _"Discussion URL", name = "discussion_url" }
76 ui.field.select{
77 label = _"Wiki engine",
78 name = "formatting_engine",
79 foreign_records = {
80 { id = "rocketwiki", name = "RocketWiki" },
81 { id = "compat", name = _"Traditional wiki syntax" }
82 },
83 foreign_id = "id",
84 foreign_name = "name"
85 }
86 ui.field.text{ label = _"Draft", name = "draft", multiline = true, attr = { style = "height: 50ex;" } }
87 ui.submit{ text = _"Save" }
88 end
89 }

Impressum / About Us