liquid_feedback_frontend

view app/main/initiative/show.lua @ 0:3bfb2fcf7ab9

Version alpha1
author bsw/jbe
date Wed Nov 18 12:00:00 2009 +0100 (2009-11-18)
parents
children 5c601807d397
line source
1 local initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec()
3 slot.put_into("html_head", '<link rel="alternate" type="application/rss+xml" title="RSS" href="../show/' .. tostring(initiative.id) .. '.rss" />')
5 execute.view{
6 module = "supporter",
7 view = "_show_box",
8 params = { initiative = initiative }
9 }
11 execute.view{
12 module = "delegation",
13 view = "_show_box",
14 params = { issue_id = initiative.issue_id }
15 }
18 slot.select("path", function()
19 ui.link{
20 content = _"Area '#{name}'":gsub("#{name}", initiative.issue.area.name),
21 module = "area",
22 view = "show",
23 id = initiative.issue.area.id
24 }
25 ui.container{ content = "::" }
26 ui.link{
27 content = _"Issue ##{id} (#{policy_name})":gsub("#{id}", initiative.issue.id):gsub("#{policy_name}", initiative.issue.policy.name),
28 module = "issue",
29 view = "show",
30 id = initiative.issue.id
31 }
32 end)
34 slot.put_into("title", encode.html(_"Initiative: '#{name}'":gsub("#{name}", initiative.shortened_name) ))
36 slot.select("actions", function()
38 ui.twitter("http://example.com/i" .. tostring(initiative.id) .. " " .. initiative.name)
40 end)
43 ui.container{
44 attr = { id = "add_suggestion_form", class = "hidden_inline_form" },
45 content = function()
47 ui.link{
48 content = _"Close",
49 attr = {
50 onclick = "document.getElementById('add_suggestion_form').style.display='none';return(false)",
51 style = "float: right;"
52 }
53 }
55 ui.field.text{ attr = { class = "head" }, value = _"Add new suggestion" }
58 ui.form{
59 module = "suggestion",
60 action = "add",
61 params = { initiative_id = initiative.id },
62 routing = {
63 default = {
64 mode = "redirect",
65 module = "initiative",
66 view = "show",
67 id = initiative.id,
68 params = { tab = "suggestion" }
69 }
70 },
71 attr = { class = "vertical" },
72 content = function()
73 ui.field.text{ label = _"Name", name = "name" }
74 ui.field.text{ label = _"Description", name = "description", multiline = true }
75 ui.field.select{
76 label = _"Degree",
77 name = "degree",
78 foreign_records = {
79 { id = 1, name = _"should"},
80 { id = 2, name = _"must"},
81 },
82 foreign_id = "id",
83 foreign_name = "name"
84 }
85 ui.submit{ text = _"Commit suggestion" }
86 end
87 }
88 end
89 }
92 ui.tabs{
93 {
94 name = "current_draft",
95 label = _"Current draft",
96 content = function()
97 execute.view{ module = "draft", view = "_show", params = { draft = initiative.current_draft } }
98 if Initiator:by_pk(initiative.id, app.session.member.id) then
99 ui.link{
100 content = function()
101 ui.image{ static = "icons/16/script_add.png" }
102 slot.put(_"Add new draft")
103 end,
104 module = "draft",
105 view = "new",
106 params = { initiative_id = initiative.id }
107 }
108 end
109 end
110 },
111 {
112 name = "details",
113 label = _"Details",
114 content = function()
115 ui.form{
116 attr = { class = "vertical" },
117 record = initiative,
118 readonly = true,
119 content = function()
120 ui.field.text{ label = _"Issue policy", value = initiative.issue.policy.name }
121 ui.field.text{
122 label = _"Created at",
123 value = tostring(initiative.created)
124 }
125 ui.field.text{
126 label = _"Created at",
127 value = format.timestamp(initiative.created)
128 }
129 ui.field.date{ label = _"Revoked at", name = "revoked" }
130 ui.field.boolean{ label = _"Admitted", name = "admitted" }
131 end
132 }
133 end
134 },
135 {
136 name = "suggestion",
137 label = _"Suggestions",
138 content = function()
139 execute.view{ module = "suggestion", view = "_list", params = { suggestions_selector = initiative:get_reference_selector("suggestions") } }
140 slot.put("<br />")
141 if not initiative.issue.frozen and not initiative.issue.closed then
142 ui.link{
143 content = function()
144 ui.image{ static = "icons/16/comment_add.png" }
145 slot.put(_"Add new suggestion")
146 end,
147 attr = { onclick = "document.getElementById('add_suggestion_form').style.display='block';return(false)" },
148 static = "#"
149 }
150 end
151 end
152 },
153 {
154 name = "supporter",
155 label = _"Supporter",
156 content = function()
157 execute.view{ module = "member", view = "_list", params = { members_selector = initiative:get_reference_selector("supporting_members") } }
158 end
159 },
160 {
161 name = "initiators",
162 label = _"Initiators",
163 content = function()
164 execute.view{ module = "member", view = "_list", params = { members_selector = initiative:get_reference_selector("initiating_members") } }
165 end
166 },
167 {
168 name = "drafts",
169 label = _"Old drafts",
170 content = function()
171 execute.view{ module = "draft", view = "_list", params = { drafts = initiative.drafts } }
172 end
173 },
174 }

Impressum / About Us