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