liquid_feedback_frontend

annotate app/main/issue/_show.lua @ 887:2cfa41e89c15

Changed wording for (un)ignore a initiative
author bsw
date Mon Aug 20 02:56:26 2012 +0200 (2012-08-20)
parents 2e9d39b53b64
children 06e72cc93c64
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@862 3 local for_member = param.get("for_member", "table")
bsw@525 4 local for_listing = param.get("for_listing", atom.boolean)
bsw@574 5 local for_initiative = param.get("for_initiative", "table")
bsw@574 6 local for_initiative_id = for_initiative and for_initiative.id or nil
bsw@525 7
bsw@525 8 local direct_voter
bsw@525 9 if app.session.member_id then
bsw@547 10 direct_voter = issue.member_info.direct_voted
bsw@525 11 end
bsw@525 12
bsw@525 13 local voteable = app.session.member_id and issue.state == 'voting' and
bsw@525 14 app.session.member:has_voting_right_for_unit_id(issue.area.unit_id)
bsw@525 15
bsw@879 16 local vote_comment_able = app.session.member_id and issue.closed and direct_voter
bsw@879 17
bsw@879 18 local vote_link_text
bsw@879 19 if voteable then
bsw@879 20 vote_link_text = direct_voter and _"Change vote" or _"Vote now"
bsw@879 21 elseif vote_comment_able then
bsw@883 22 vote_link_text = direct_voter and _"Update voting comment"
bsw@879 23 end
bsw@525 24
bsw@525 25
bsw@525 26 local class = "issue"
bsw@525 27 if issue.is_interested then
bsw@525 28 class = class .. " interested"
bsw@525 29 elseif issue.is_interested_by_delegation_to_member_id then
bsw@525 30 class = class .. " interested_by_delegation"
bsw@525 31 end
bsw@525 32
bsw@525 33 ui.container{ attr = { class = class }, content = function()
bsw@525 34
bsw@862 35 execute.view{ module = "delegation", view = "_info", params = { issue = issue, member = for_member } }
bsw@525 36
bsw@635 37 if for_listing then
bsw@635 38 ui.container{ attr = { class = "content" }, content = function()
bsw@678 39 ui.link{
bsw@678 40 module = "unit", view = "show", id = issue.area.unit_id,
bsw@678 41 attr = { class = "unit_link" }, text = issue.area.unit.name
bsw@678 42 }
bsw@678 43 slot.put(" ")
bsw@678 44 ui.link{
bsw@678 45 module = "area", view = "show", id = issue.area_id,
bsw@678 46 attr = { class = "area_link" }, text = issue.area.name
bsw@678 47 }
bsw@635 48 end }
bsw@635 49 end
bsw@635 50
bsw@525 51 ui.container{ attr = { class = "title" }, content = function()
bsw@525 52
bsw@525 53 ui.link{
bsw@525 54 attr = { class = "issue_id" },
bsw@525 55 text = _("#{policy_name} ##{issue_id}", {
bsw@525 56 policy_name = issue.policy.name,
bsw@525 57 issue_id = issue.id
bsw@525 58 }),
bsw@525 59 module = "issue",
bsw@525 60 view = "show",
bsw@525 61 id = issue.id
bsw@525 62 }
bsw@525 63 end }
bsw@525 64
bsw@525 65 ui.tag{
bsw@525 66 attr = { class = "content issue_policy_info" },
bsw@525 67 tag = "div",
bsw@525 68 content = function()
bsw@525 69
bsw@525 70 ui.tag{ attr = { class = "event_name" }, content = issue.state_name }
bsw@525 71
bsw@863 72 if issue.closed then
bsw@863 73 slot.put(" · ")
bsw@863 74 ui.tag{ content = _("#{closed_ago} ago", { closed_ago = issue.closed_ago:gsub("%..*", ""):gsub("days", _"days"):gsub("day", _"day") }) }
bsw@863 75 elseif issue.state_time_left then
bsw@525 76 slot.put(" · ")
bsw@525 77 if issue.state_time_left:sub(1,1) == "-" then
bsw@550 78 if issue.state == "accepted" then
bsw@525 79 ui.tag{ content = _("Discussion starts soon") }
bsw@525 80 elseif issue.state == "discussion" then
bsw@525 81 ui.tag{ content = _("Verification starts soon") }
bsw@525 82 elseif issue.state == "frozen" then
bsw@525 83 ui.tag{ content = _("Voting starts soon") }
bsw@525 84 elseif issue.state == "voting" then
bsw@525 85 ui.tag{ content = _("Counting starts soon") }
bsw@525 86 end
bsw@525 87 else
bsw@723 88 ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left:gsub("%..*", ""):gsub("days", _"days"):gsub("day", _"day") }) }
bsw@525 89 end
bsw@525 90 end
bsw@525 91
bsw@525 92 end
bsw@525 93 }
bsw@525 94
bsw@572 95 local links = {}
bsw@525 96
bsw@879 97 if vote_link_text then
bsw@862 98 links[#links+1] ={
bsw@862 99 content = vote_link_text,
bsw@862 100 module = "vote",
bsw@862 101 view = "list",
bsw@862 102 params = { issue_id = issue.id }
bsw@862 103 }
bsw@862 104 end
bsw@886 105
bsw@886 106 if voteable and not direct_voter then
bsw@886 107 if not issue.member_info.non_voter then
bsw@886 108 links[#links+1] ={
bsw@886 109 content = _"Do not vote directly",
bsw@886 110 module = "vote",
bsw@886 111 action = "non_voter",
bsw@886 112 params = { issue_id = issue.id },
bsw@886 113 routing = {
bsw@886 114 default = {
bsw@886 115 mode = "redirect",
bsw@886 116 module = request.get_module(),
bsw@886 117 view = request.get_view(),
bsw@886 118 id = param.get_id_cgi(),
bsw@886 119 params = param.get_all_cgi()
bsw@886 120 }
bsw@886 121 }
bsw@886 122 }
bsw@886 123 else
bsw@886 124 links[#links+1] = { attr = { class = "action" }, content = _"Do not vote directly" }
bsw@886 125 links[#links+1] ={
bsw@886 126 content = _"Cancel do not vote",
bsw@886 127 module = "vote",
bsw@886 128 action = "non_voter",
bsw@886 129 params = { issue_id = issue.id, delete = true },
bsw@886 130 routing = {
bsw@886 131 default = {
bsw@886 132 mode = "redirect",
bsw@886 133 module = request.get_module(),
bsw@886 134 view = request.get_view(),
bsw@886 135 id = param.get_id_cgi(),
bsw@886 136 params = param.get_all_cgi()
bsw@886 137 }
bsw@886 138 }
bsw@886 139 }
bsw@886 140 end
bsw@886 141 end
bsw@525 142
bsw@862 143 if not for_member or for_member.id == app.session.member_id then
bsw@862 144
bsw@525 145 if app.session.member_id then
bsw@572 146
bsw@572 147 if issue.member_info.own_participation then
bsw@572 148 if issue.closed then
bsw@572 149 links[#links+1] = { content = _"You were interested" }
bsw@572 150 else
bsw@572 151 links[#links+1] = { content = _"You are interested" }
bsw@572 152 end
bsw@572 153 end
bsw@572 154
bsw@572 155 if not issue.closed and not issue.fully_frozen then
bsw@572 156 if issue.member_info.own_participation then
bsw@572 157 links[#links+1] = {
bsw@572 158 in_brackets = true,
bsw@572 159 text = _"Withdraw",
bsw@572 160 module = "interest",
bsw@572 161 action = "update",
bsw@572 162 params = { issue_id = issue.id, delete = true },
bsw@572 163 routing = {
bsw@572 164 default = {
bsw@572 165 mode = "redirect",
bsw@572 166 module = request.get_module(),
bsw@572 167 view = request.get_view(),
bsw@572 168 id = param.get_id_cgi(),
bsw@572 169 params = param.get_all_cgi()
bsw@572 170 }
bsw@572 171 }
bsw@572 172 }
bsw@572 173 elseif app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
bsw@572 174 links[#links+1] = {
bsw@572 175 text = _"Add my interest",
bsw@572 176 module = "interest",
bsw@572 177 action = "update",
bsw@572 178 params = { issue_id = issue.id },
bsw@572 179 routing = {
bsw@572 180 default = {
bsw@572 181 mode = "redirect",
bsw@572 182 module = request.get_module(),
bsw@572 183 view = request.get_view(),
bsw@572 184 id = param.get_id_cgi(),
bsw@572 185 params = param.get_all_cgi()
bsw@572 186 }
bsw@572 187 }
bsw@572 188 }
bsw@572 189 end
bsw@572 190 end
bsw@525 191
bsw@862 192 if not issue.closed and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
bsw@862 193 if issue.member_info.own_delegation_scope ~= "issue" then
bsw@862 194 links[#links+1] = { text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } }
bsw@862 195 else
bsw@862 196 links[#links+1] = { text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } }
bsw@862 197 end
bsw@529 198 end
bsw@529 199 end
bsw@529 200
bsw@525 201 if config.issue_discussion_url_func then
bsw@525 202 local url = config.issue_discussion_url_func(issue)
bsw@572 203 links[#links+1] = {
bsw@525 204 attr = { target = "_blank" },
bsw@525 205 external = url,
bsw@525 206 content = _"Discussion on issue"
bsw@525 207 }
bsw@525 208 end
bsw@525 209
bsw@525 210 if config.etherpad and app.session.member then
bsw@572 211 links[#links+1] = {
bsw@525 212 attr = { target = "_blank" },
bsw@525 213 external = issue.etherpad_url,
bsw@525 214 content = _"Issue pad"
bsw@525 215 }
bsw@525 216 end
bsw@525 217
bsw@525 218
bsw@525 219 if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
bsw@525 220 if not issue.fully_frozen and not issue.closed then
bsw@572 221 links[#links+1] = {
bsw@525 222 attr = { class = "action" },
bsw@525 223 text = _"Create alternative initiative",
bsw@525 224 module = "initiative",
bsw@525 225 view = "new",
bsw@525 226 params = { issue_id = issue.id }
bsw@525 227 }
bsw@525 228 end
bsw@525 229 end
bsw@525 230
bsw@862 231 end
bsw@862 232
bsw@572 233 ui.container{ attr = { class = "content actions" }, content = function()
bsw@572 234 for i, link in ipairs(links) do
bsw@572 235 if link.in_brackets then
bsw@572 236 slot.put(" (")
bsw@572 237 elseif i > 1 then
bsw@572 238 slot.put(" · ")
bsw@572 239 end
bsw@582 240 if link.module or link.external then
bsw@572 241 ui.link(link)
bsw@572 242 else
bsw@572 243 ui.tag(link)
bsw@572 244 end
bsw@572 245 if link.in_brackets then
bsw@572 246 slot.put(")")
bsw@572 247 end
bsw@572 248 end
bsw@525 249 end }
bsw@525 250
bsw@525 251 if not for_listing then
bsw@527 252 if issue.state == "cancelled" then
bsw@527 253 local policy = issue.policy
bsw@527 254 ui.container{
bsw@527 255 attr = { class = "not_admitted_info" },
bsw@527 256 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 257 }
bsw@527 258 end
bsw@525 259 end
bsw@525 260
bsw@642 261 ui.container{ attr = { class = "initiative_list content" }, content = function()
bsw@525 262
bsw@525 263 local initiatives_selector = issue:get_reference_selector("initiatives")
bsw@525 264 local highlight_string = param.get("highlight_string")
bsw@525 265 if highlight_string then
bsw@525 266 initiatives_selector:add_field( {'"highlight"("initiative"."name", ?)', highlight_string }, "name_highlighted")
bsw@525 267 end
bsw@525 268 execute.view{
bsw@525 269 module = "initiative",
bsw@525 270 view = "_list",
bsw@525 271 params = {
bsw@525 272 issue = issue,
bsw@525 273 initiatives_selector = initiatives_selector,
bsw@715 274 highlight_initiative = for_initiative,
bsw@525 275 highlight_string = highlight_string,
bsw@525 276 no_sort = true,
bsw@715 277 limit = (for_listing or for_initiative) and 5 or nil,
bsw@525 278 for_member = for_member
bsw@525 279 }
bsw@525 280 }
bsw@525 281 end }
bsw@525 282 end }
bsw@525 283

Impressum / About Us