liquid_feedback_frontend

view app/main/issue/_show.lua @ 529:5ca9de94cb13

Delegation preview when setting delegation, optical enhancements, typos fixed
author bsw
date Sun May 20 19:43:01 2012 +0200 (2012-05-20)
parents 305329da1c75
children 57a261a81c5a
line source
1 local issue = param.get("issue", "table")
2 local initiative_limit = param.get("initiative_limit", atom.integer)
3 local for_listing = param.get("for_listing", atom.boolean)
5 local direct_voter
6 if app.session.member_id then
7 direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id)
8 end
10 local voteable = app.session.member_id and issue.state == 'voting' and
11 app.session.member:has_voting_right_for_unit_id(issue.area.unit_id)
13 local vote_link_text = direct_voter and _"Change vote" or "Vote now"
15 issue:load_delegation_info_once_for_member_id(app.session.member_id)
18 local class = "issue"
19 if issue.is_interested then
20 class = class .. " interested"
21 elseif issue.is_interested_by_delegation_to_member_id then
22 class = class .. " interested_by_delegation"
23 end
25 ui.container{ attr = { class = class }, content = function()
27 execute.view{ module = "delegation", view = "_info", params = { issue = issue } }
29 ui.container{ attr = { class = "title" }, content = function()
31 ui.link{
32 attr = { class = "issue_id" },
33 text = _("#{policy_name} ##{issue_id}", {
34 policy_name = issue.policy.name,
35 issue_id = issue.id
36 }),
37 module = "issue",
38 view = "show",
39 id = issue.id
40 }
41 if for_listing then
42 ui.tag{ attr = { class = "extra" }, content = function()
43 ui.tag{ content = issue.area.unit.name }
44 slot.put(" · ")
45 ui.tag{ content = issue.area.name }
46 end }
47 end
48 end }
50 ui.tag{
51 attr = { class = "content issue_policy_info" },
52 tag = "div",
53 content = function()
55 ui.tag{ attr = { class = "event_name" }, content = issue.state_name }
57 if issue.state_time_left then
58 slot.put(" · ")
59 if issue.state_time_left:sub(1,1) == "-" then
60 if issue.state == "new" then
61 ui.tag{ content = _("Discussion starts soon") }
62 elseif issue.state == "discussion" then
63 ui.tag{ content = _("Verification starts soon") }
64 elseif issue.state == "frozen" then
65 ui.tag{ content = _("Voting starts soon") }
66 elseif issue.state == "voting" then
67 ui.tag{ content = _("Counting starts soon") }
68 end
69 else
70 ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left:gsub("days", _"days"):gsub("day", _"day") }) }
71 end
72 end
74 end
75 }
77 ui.container{
78 attr = { class = "content actions" }, content = function()
80 if voteable then
81 ui.link{
82 content = vote_link_text,
83 module = "vote",
84 view = "list",
85 params = { issue_id = issue.id }
86 }
87 slot.put(" · ")
88 end
90 if app.session.member_id then
91 execute.view{
92 module = "interest",
93 view = "_show_box",
94 params = { issue = issue, initiative = initiative }
95 }
96 slot.put(" · ")
97 end
99 if not issue.closed then
100 if issue.delegation_info.own_delegation_scope ~= "issue" then
101 ui.link{ text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id } }
102 else
103 ui.link{ text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id } }
104 end
105 slot.put(" · ")
106 end
108 if config.issue_discussion_url_func then
109 local url = config.issue_discussion_url_func(issue)
110 ui.link{
111 attr = { target = "_blank" },
112 external = url,
113 content = _"Discussion on issue"
114 }
115 slot.put(" · ")
116 end
118 if config.etherpad and app.session.member then
119 ui.link{
120 attr = { target = "_blank" },
121 external = issue.etherpad_url,
122 content = _"Issue pad"
123 }
124 slot.put(" · ")
125 end
128 if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
129 if not issue.fully_frozen and not issue.closed then
130 ui.link{
131 attr = { class = "action" },
132 text = _"Create alternative initiative",
133 module = "initiative",
134 view = "new",
135 params = { issue_id = issue.id }
136 }
137 end
138 end
140 end }
142 if not for_listing then
144 if voteable then
145 ui.container{
146 attr = { class = "voting_active_info" },
147 content = function()
148 slot.put(_"Voting for this issue is currently running!")
149 slot.put(" ")
150 if app.session.member_id then
151 ui.link{
152 content = vote_link_text,
153 module = "vote",
154 view = "list",
155 params = { issue_id = issue.id }
156 }
157 end
158 end
159 }
160 end
162 if issue.state == "cancelled" then
163 local policy = issue.policy
164 ui.container{
165 attr = { class = "not_admitted_info" },
166 content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) })
167 }
168 end
170 end
172 ui.container{ attr = { class = "initiative_list" }, content = function()
174 local initiatives_selector = issue:get_reference_selector("initiatives")
175 local highlight_string = param.get("highlight_string")
176 if highlight_string then
177 initiatives_selector:add_field( {'"highlight"("initiative"."name", ?)', highlight_string }, "name_highlighted")
178 end
179 execute.view{
180 module = "initiative",
181 view = "_list",
182 params = {
183 issue = issue,
184 initiatives_selector = initiatives_selector,
185 highlight_string = highlight_string,
186 per_page = initiative_limit,
187 no_sort = true,
188 limit = initiative_limit,
189 for_member = for_member
190 }
191 }
192 end }
193 end }

Impressum / About Us