liquid_feedback_frontend
view app/main/initiative/_show.lua @ 24:81586ea68d57
Minor bugfixes
app/main/initiative/_list.lua:
Replaced single by optional object mode
locale/translations.de.lua:
Consistent translation
app/main/initiative/_show.lua:
Added missing case "not approved" in voting info box
app/main/initiative/_show_voting.lua:
Added link to initiative
app/main/initiative/_show_voting.lua:
Added missing argument for link
app/main/member/show_tab.lua:
Added outgoing argument to show outgoing delegations correctly
app/main/initiative/_list.lua:
Replaced single by optional object mode
locale/translations.de.lua:
Consistent translation
app/main/initiative/_show.lua:
Added missing case "not approved" in voting info box
app/main/initiative/_show_voting.lua:
Added link to initiative
app/main/initiative/_show_voting.lua:
Added missing argument for link
app/main/member/show_tab.lua:
Added outgoing argument to show outgoing delegations correctly
author | bsw |
---|---|
date | Sun Feb 21 14:09:11 2010 +0100 (2010-02-21) |
parents | 00d1004545f1 |
children | 53a45356c107 |
line source
1 local initiative = param.get("initiative", "table")
2 local initiator = param.get("initiator", "table")
4 util.help("initiative.show")
6 if initiative.issue.ranks_available and initiative.admitted then
7 local class = initiative.rank == 1 and "admitted_info" or "not_admitted_info"
8 ui.container{
9 attr = { class = class },
10 content = function()
11 local max_value = initiative.issue.voter_count
12 slot.put(" ")
13 local positive_votes = initiative.positive_votes
14 local negative_votes = initiative.negative_votes
15 slot.put(_"Yes" .. ": <b>" .. tostring(positive_votes) .. "</b>")
16 slot.put(" · ")
17 slot.put(_"Abstention" .. ": <b>" .. tostring(max_value - initiative.negative_votes - initiative.positive_votes) .. "</b>")
18 slot.put(" · ")
19 slot.put(_"No" .. ": <b>" .. tostring(initiative.negative_votes) .. "</b>")
20 slot.put(" · ")
21 slot.put("<b>")
22 if initiative.rank == 1 then
23 slot.put(_"Approved")
24 elseif initiative.rank then
25 slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank }))
26 else
27 slot.put(_"Not approved")
28 end
29 slot.put("</b>")
30 end
31 }
32 end
34 if initiative.admitted == false then
35 local policy = initiative.issue.policy
36 ui.container{
37 attr = { class = "not_admitted_info" },
38 content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) })
39 }
40 end
42 local web20 = config.user_tab_mode == "accordeon"
43 or config.user_tab_mode == "accordeon_first_expanded"
44 or config.user_tab_mode == "accordeon_all_expanded"
46 if not web20 and initiative.issue.state == "cancelled" then
47 local policy = initiative.issue.policy
48 ui.container{
49 attr = { class = "not_admitted_info" },
50 content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) })
51 }
52 end
54 if initiative.revoked then
55 ui.container{
56 attr = { class = "revoked_info" },
57 content = function()
58 slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) }))
59 local suggested_initiative = initiative.suggested_initiative
60 if suggested_initiative then
61 slot.put("<br /><br />")
62 slot.put(_("The initiators suggest to support the following initiative:"))
63 slot.put(" ")
64 ui.link{
65 content = _("Issue ##{id}", { id = suggested_initiative.issue.id } ) .. ": " .. encode.html(suggested_initiative.name),
66 module = "initiative",
67 view = "show",
68 id = suggested_initiative.id
69 }
70 end
71 end
72 }
73 end
75 if initiator and initiator.accepted == nil then
76 ui.container{
77 attr = { class = "initiator_invite_info" },
78 content = function()
79 slot.put(_"You are invited to become initiator of this initiative.")
80 slot.put(" ")
81 ui.link{
82 image = { static = "icons/16/tick.png" },
83 text = _"Accept invitation",
84 module = "initiative",
85 action = "accept_invitation",
86 id = initiative.id,
87 routing = {
88 default = {
89 mode = "redirect",
90 module = request.get_module(),
91 view = request.get_view(),
92 id = param.get_id_cgi(),
93 params = param.get_all_cgi()
94 }
95 }
96 }
97 slot.put(" ")
98 ui.link{
99 image = { static = "icons/16/cross.png" },
100 text = _"Refuse invitation",
101 module = "initiative",
102 action = "reject_initiator_invitation",
103 params = {
104 initiative_id = initiative.id,
105 member_id = app.session.member.id
106 },
107 routing = {
108 default = {
109 mode = "redirect",
110 module = request.get_module(),
111 view = request.get_view(),
112 id = param.get_id_cgi(),
113 params = param.get_all_cgi()
114 }
115 }
116 }
117 end
118 }
119 slot.put("<br />")
120 end
123 local supporter = app.session.member:get_reference_selector("supporters")
124 :add_where{ "initiative_id = ?", initiative.id }
125 :optional_object_mode()
126 :exec()
128 if supporter and not initiative.issue.closed then
129 local old_draft_id = supporter.draft_id
130 local new_draft_id = initiative.current_draft.id
131 if old_draft_id ~= new_draft_id then
132 ui.container{
133 attr = { class = "draft_updated_info" },
134 content = function()
135 slot.put(_"The draft of this initiative has been updated!")
136 slot.put(" ")
137 ui.link{
138 content = _"Show diff",
139 module = "draft",
140 view = "diff",
141 params = {
142 old_draft_id = old_draft_id,
143 new_draft_id = new_draft_id
144 }
145 }
146 slot.put(" ")
147 ui.link{
148 text = _"Refresh support to current draft",
149 module = "initiative",
150 action = "add_support",
151 id = initiative.id,
152 routing = {
153 default = {
154 mode = "redirect",
155 module = "initiative",
156 view = "show",
157 id = initiative.id
158 }
159 }
160 }
161 end
162 }
163 end
164 end
168 ui.container{
169 attr = {
170 id = "initiative_" .. tostring(initiative.id) .. "_support"
171 },
172 content = function()
173 execute.view{
174 module = "initiative",
175 view = "show_support",
176 params = {
177 initiative = initiative
178 }
179 }
180 end
181 }
183 if (initiative.discussion_url and #initiative.discussion_url > 0)
184 or (initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked) then
185 ui.container{
186 attr = { class = "vertical" },
187 content = function()
188 ui.container{
189 attr = { class = "ui_field_label" },
190 content = _"Discussion with initiators"
191 }
192 ui.tag{
193 tag = "span",
194 content = function()
195 if initiative.discussion_url:find("^https?://") then
196 if initiative.discussion_url and #initiative.discussion_url > 0 then
197 ui.link{
198 attr = {
199 class = "actions",
200 target = "_blank",
201 title = initiative.discussion_url
202 },
203 content = function()
204 slot.put(encode.html(initiative.discussion_url))
205 end,
206 external = initiative.discussion_url
207 }
208 end
209 else
210 slot.put(encode.html(initiative.discussion_url))
211 end
212 slot.put(" ")
213 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
214 ui.link{
215 attr = { class = "actions" },
216 text = _"(change URL)",
217 module = "initiative",
218 view = "edit",
219 id = initiative.id
220 }
221 end
222 end
223 }
224 end
225 }
226 end
230 execute.view{
231 module = "initiative",
232 view = "show_tab",
233 params = {
234 initiative = initiative,
235 initiator = initiator
236 }
237 }