liquid_feedback_frontend
diff app/main/issue/_sidebar_whatcanido.lua @ 1309:32cc544d5a5b
Cumulative patch for upcoming frontend version 4
| author | bsw/jbe |
|---|---|
| date | Sun Jul 15 14:07:29 2018 +0200 (2018-07-15) |
| parents | 904f6807f7fa |
| children | 9d15d509b5f6 |
line diff
1.1 --- a/app/main/issue/_sidebar_whatcanido.lua Thu Jun 23 03:30:57 2016 +0200 1.2 +++ b/app/main/issue/_sidebar_whatcanido.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -19,488 +19,557 @@ 1.4 end 1.5 end 1.6 1.7 -ui.sidebar ( "tab-whatcanido", function () 1.8 +local supporter 1.9 1.10 - ui.sidebarHeadWhatCanIDo() 1.11 - 1.12 - local supporter 1.13 +if initiative and app.session.member_id then 1.14 + supporter = app.session.member:get_reference_selector("supporters") 1.15 + :add_where{ "initiative_id = ?", initiative.id } 1.16 + :optional_object_mode() 1.17 + :exec() 1.18 +end 1.19 + 1.20 +local view_module 1.21 +local view_id 1.22 1.23 - if initiative and app.session.member_id then 1.24 - supporter = app.session.member:get_reference_selector("supporters") 1.25 - :add_where{ "initiative_id = ?", initiative.id } 1.26 - :optional_object_mode() 1.27 - :exec() 1.28 - end 1.29 +if initiative then 1.30 + issue = issue 1.31 + view_module = "initiative" 1.32 + view_id = initiative.id 1.33 +else 1.34 + view_module = "issue" 1.35 + view_id = issue.id 1.36 +end 1.37 1.38 - local view_module 1.39 - local view_id 1.40 +local initiator 1.41 +if initiative and app.session.member_id then 1.42 + initiator = Initiator:by_pk(initiative.id, app.session.member.id) 1.43 +end 1.44 + 1.45 +local initiators 1.46 1.47 - if initiative then 1.48 - issue = issue 1.49 - view_module = "initiative" 1.50 - view_id = initiative.id 1.51 +if initiative then 1.52 + local initiators_members_selector = initiative:get_reference_selector("initiating_members") 1.53 + :add_field("initiator.accepted", "accepted") 1.54 + :add_order_by("member.name") 1.55 + if initiator and initiator.accepted then 1.56 + initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted") 1.57 else 1.58 - view_module = "issue" 1.59 - view_id = issue.id 1.60 + initiators_members_selector:add_where("initiator.accepted") 1.61 end 1.62 1.63 - local initiator 1.64 - if initiative and app.session.member_id then 1.65 - initiator = Initiator:by_pk(initiative.id, app.session.member.id) 1.66 - end 1.67 - 1.68 - local initiators 1.69 - 1.70 - if initiative then 1.71 - local initiators_members_selector = initiative:get_reference_selector("initiating_members") 1.72 - :add_field("initiator.accepted", "accepted") 1.73 - :add_order_by("member.name") 1.74 - if initiator and initiator.accepted then 1.75 - initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted") 1.76 - else 1.77 - initiators_members_selector:add_where("initiator.accepted") 1.78 - end 1.79 - 1.80 - initiators = initiators_members_selector:exec() 1.81 - end 1.82 + initiators = initiators_members_selector:exec() 1.83 +end 1.84 1.85 - if initiator and 1.86 - initiator.accepted and 1.87 - not issue.fully_frozen and 1.88 - not issue.closed and 1.89 - not initiative.revoked 1.90 - then 1.91 +ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() 1.92 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.93 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"What can I do here?" } 1.94 + end } 1.95 + ui.container{ attr = { class = "what-can-i-do-here" }, content = function() 1.96 + 1.97 + if initiator and 1.98 + initiator.accepted and 1.99 + not issue.fully_frozen and 1.100 + not issue.closed and 1.101 + not initiative.revoked 1.102 + then 1.103 1.104 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.105 - ui.heading { level = 3, content = function() 1.106 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.107 ui.tag { content = _"You are initiator of this initiative" } 1.108 - end } 1.109 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.110 - if issue.half_frozen then 1.111 - ui.tag { tag = "li", content = _"this issue is in verification phase, therefore the initiative text cannot be updated anymore" } 1.112 - else 1.113 - ui.tag { tag = "li", content = function () 1.114 - ui.link{ 1.115 - module = "draft", view = "new", 1.116 - params = { initiative_id = initiative.id }, 1.117 - content = _"edit proposal and/or reasons" 1.118 - } 1.119 - end } 1.120 - ui.tag { tag = "li", content = function () 1.121 - ui.link{ 1.122 - attr = { class = "action" }, 1.123 - module = "initiative", view = "add_initiator", 1.124 - params = { initiative_id = initiative.id }, 1.125 - content = _"invite another initiator" 1.126 - } 1.127 - end } 1.128 - if #initiative.initiators > 1 then 1.129 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.130 + if issue.half_frozen then 1.131 + ui.tag { tag = "li", content = _"this issue is in verification phase, therefore the initiative text cannot be updated anymore" } 1.132 + else 1.133 ui.tag { tag = "li", content = function () 1.134 ui.link{ 1.135 - module = "initiative", view = "remove_initiator", 1.136 + module = "draft", view = "new", 1.137 + params = { initiative_id = initiative.id }, 1.138 + content = _"edit proposal and/or reasons" 1.139 + } 1.140 + end } 1.141 + ui.tag { tag = "li", content = function () 1.142 + ui.link{ 1.143 + attr = { class = "action" }, 1.144 + module = "initiative", view = "add_initiator", 1.145 params = { initiative_id = initiative.id }, 1.146 - content = _"remove an initiator" 1.147 + content = _"invite another initiator" 1.148 + } 1.149 + end } 1.150 + if #initiative.initiators > 1 then 1.151 + ui.tag { tag = "li", content = function () 1.152 + ui.link{ 1.153 + module = "initiative", view = "remove_initiator", 1.154 + params = { initiative_id = initiative.id }, 1.155 + content = _"remove an initiator" 1.156 + } 1.157 + end } 1.158 + end 1.159 + ui.tag { tag = "li", content = function () 1.160 + ui.link{ 1.161 + module = "initiative", view = "revoke", id = initiative.id, 1.162 + content = _"revoke initiative" 1.163 } 1.164 end } 1.165 end 1.166 - ui.tag { tag = "li", content = function () 1.167 + end } 1.168 + end } 1.169 + end 1.170 + 1.171 + -- invited as initiator 1.172 + if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then 1.173 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.174 + ui.tag { content = _"You are invited to become initiator of this initiative" } 1.175 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.176 + ui.tag{ tag = "li", content = function () 1.177 ui.link{ 1.178 - module = "initiative", view = "revoke", id = initiative.id, 1.179 - content = _"revoke initiative" 1.180 + content = _"accept invitation", 1.181 + module = "initiative", 1.182 + action = "accept_invitation", 1.183 + id = initiative.id, 1.184 + routing = { 1.185 + default = { 1.186 + mode = "redirect", 1.187 + module = request.get_module(), 1.188 + view = request.get_view(), 1.189 + id = request.get_id_string(), 1.190 + params = request.get_param_strings() 1.191 + } 1.192 + } 1.193 } 1.194 end } 1.195 - end 1.196 - end } 1.197 - end } 1.198 - end 1.199 - 1.200 - -- invited as initiator 1.201 - if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then 1.202 - ui.container { attr = { class = "sidebarRow highlighted" }, content = function () 1.203 - ui.heading { level = 3, content = function() 1.204 - ui.tag { content = _"You are invited to become initiator of this initiative" } 1.205 - end } 1.206 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.207 - ui.tag{ tag = "li", content = function () 1.208 - ui.link{ 1.209 - content = _"accept invitation", 1.210 - module = "initiative", 1.211 - action = "accept_invitation", 1.212 - id = initiative.id, 1.213 - routing = { 1.214 - default = { 1.215 - mode = "redirect", 1.216 - module = request.get_module(), 1.217 - view = request.get_view(), 1.218 - id = request.get_id_string(), 1.219 - params = request.get_param_strings() 1.220 + 1.221 + ui.tag{ tag = "li", content = function () 1.222 + ui.link{ 1.223 + content = _"refuse invitation", 1.224 + module = "initiative", 1.225 + action = "reject_initiator_invitation", 1.226 + params = { 1.227 + initiative_id = initiative.id, 1.228 + member_id = app.session.member.id 1.229 + }, 1.230 + routing = { 1.231 + default = { 1.232 + mode = "redirect", 1.233 + module = request.get_module(), 1.234 + view = request.get_view(), 1.235 + id = request.get_id_string(), 1.236 + params = request.get_param_strings() 1.237 + } 1.238 } 1.239 } 1.240 - } 1.241 + end } 1.242 end } 1.243 - 1.244 - ui.tag{ tag = "li", content = function () 1.245 - ui.link{ 1.246 - content = _"refuse invitation", 1.247 - module = "initiative", 1.248 - action = "reject_initiator_invitation", 1.249 + end } 1.250 + end 1.251 + 1.252 + 1.253 + if privileged_to_vote and issue.member_info.first_trustee_id then 1.254 + local member = Member:by_id(issue.member_info.first_trustee_id) 1.255 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.256 + --[[ 1.257 + ui.container { attr = { class = "right" }, content = function() 1.258 + execute.view{ 1.259 + module = "member_image", 1.260 + view = "_show", 1.261 params = { 1.262 - initiative_id = initiative.id, 1.263 - member_id = app.session.member.id 1.264 - }, 1.265 - routing = { 1.266 - default = { 1.267 - mode = "redirect", 1.268 - module = request.get_module(), 1.269 - view = request.get_view(), 1.270 - id = request.get_id_string(), 1.271 - params = request.get_param_strings() 1.272 - } 1.273 + member = member, 1.274 + image_type = "avatar", 1.275 + show_dummy = true 1.276 } 1.277 } 1.278 end } 1.279 - end } 1.280 - end } 1.281 - end 1.282 - 1.283 - 1.284 - if privileged_to_vote and issue.member_info.first_trustee_id then 1.285 - local member = Member:by_id(issue.member_info.first_trustee_id) 1.286 - ui.sidebarSection( function () 1.287 - ui.container { attr = { class = "right" }, content = function() 1.288 - execute.view{ 1.289 - module = "member_image", 1.290 - view = "_show", 1.291 - params = { 1.292 - member = member, 1.293 - image_type = "avatar", 1.294 - show_dummy = true 1.295 - } 1.296 - } 1.297 - end } 1.298 - if issue.member_info.own_delegation_scope == "unit" then 1.299 - ui.heading{ level = 3, content = _"You delegated this organizational unit" } 1.300 - elseif issue.member_info.own_delegation_scope == "area" then 1.301 - ui.heading{ level = 3, content = _"You delegated this subject area" } 1.302 - elseif issue.member_info.own_delegation_scope == "issue" then 1.303 - ui.heading{ level = 3, content = _"You delegated this issue" } 1.304 - end 1.305 - 1.306 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.307 - if issue.member_info.own_delegation_scope == "area" or 1.308 - issue.member_info.own_delegation_scope == "unit" then 1.309 - ui.tag { tag = "li", content = function () 1.310 - ui.link { 1.311 - module = "delegation", view = "show", params = { 1.312 - issue_id = issue.id, 1.313 - initiative_id = initiative and initiative.id or nil 1.314 - }, 1.315 - content = _"change/revoke delegation only for this issue" 1.316 - } 1.317 - end } 1.318 - end 1.319 + --]] 1.320 if issue.member_info.own_delegation_scope == "unit" then 1.321 - ui.tag { tag = "li", content = function () 1.322 - ui.link { 1.323 - module = "delegation", view = "show", params = { 1.324 - unit_id = issue.area.unit_id, 1.325 - }, 1.326 - content = _("change/revoke delegation of organizational unit", { 1.327 - unit_name = issue.area.unit.name 1.328 - }) 1.329 - } 1.330 - end } 1.331 + ui.tag{ content = _"You delegated this organizational unit" } 1.332 elseif issue.member_info.own_delegation_scope == "area" then 1.333 - ui.tag { tag = "li", content = function () 1.334 - ui.link { 1.335 - module = "delegation", view = "show", params = { 1.336 - area_id = issue.area_id, 1.337 - }, 1.338 - content = _"change/revoke delegation of subject area" 1.339 - } 1.340 - end } 1.341 - end 1.342 - if issue.member_info.own_delegation_scope == nil then 1.343 - ui.tag { tag = "li", content = function () 1.344 - ui.link { 1.345 - module = "delegation", view = "show", params = { 1.346 - issue_id = issue.id, 1.347 - initiative_id = initiative and initiative.id or nil 1.348 - }, 1.349 - content = _"choose issue delegatee" 1.350 - } 1.351 - end } 1.352 + ui.tag{ content = _"You delegated this subject area" } 1.353 elseif issue.member_info.own_delegation_scope == "issue" then 1.354 - ui.tag { tag = "li", content = function () 1.355 - ui.link { 1.356 - module = "delegation", view = "show", params = { 1.357 - issue_id = issue.id, 1.358 - initiative_id = initiative and initiative.id or nil 1.359 - }, 1.360 - content = _"change/revoke issue delegation" 1.361 - } 1.362 - end } 1.363 - end 1.364 - end } 1.365 - 1.366 - if issue.member_info.first_trustee_id and issue.member_info.own_participation then 1.367 - local text = _"As long as you are interested in this issue yourself, the delegation is suspended for this issue, but it will be applied again in the voting phase unless you vote yourself." 1.368 - if issue.state == "voting" then 1.369 - text = _"This delegation is suspended, because you voted yourself." 1.370 + ui.tag{ content = _"You delegated this issue" } 1.371 end 1.372 - ui.container { content = text } 1.373 - end 1.374 - end ) 1.375 - end 1.376 - 1.377 - if privileged_to_vote and not issue.closed and not issue.fully_frozen then 1.378 - if issue.member_info.own_participation then 1.379 - ui.sidebarSection( function () 1.380 - ui.container{ attr = { class = "right" }, content = function() 1.381 - ui.image{ attr = { class = "right" }, static = "icons/48/eye.png" } 1.382 - if issue.member_info.weight and issue.member_info.weight > 1 then 1.383 - slot.put("<br />") 1.384 - ui.tag{ 1.385 - attr = { class = "right" }, 1.386 - content = "+" .. issue.member_info.weight - 1 1.387 - } 1.388 - end 1.389 - end } 1.390 - ui.heading{ level = 3, content = _("You are interested in this issue", { id = issue.id }) } 1.391 + 1.392 ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.393 - if issue.member_info.weight and issue.member_info.weight > 1 then 1.394 + if issue.member_info.own_delegation_scope == "area" or 1.395 + issue.member_info.own_delegation_scope == "unit" then 1.396 ui.tag { tag = "li", content = function () 1.397 ui.link { 1.398 - module = "delegation", view = "show_incoming", 1.399 - params = { issue_id = issue.id, member_id = app.session.member_id }, 1.400 - content = _("you have #{count} incoming delegations", { 1.401 - count = issue.member_info.weight - 1 1.402 + module = "delegation", view = "show", params = { 1.403 + issue_id = issue.id, 1.404 + initiative_id = initiative and initiative.id or nil 1.405 + }, 1.406 + content = _"change/revoke delegation only for this issue" 1.407 + } 1.408 + end } 1.409 + end 1.410 + if issue.member_info.own_delegation_scope == "unit" then 1.411 + ui.tag { tag = "li", content = function () 1.412 + ui.link { 1.413 + module = "delegation", view = "show", params = { 1.414 + unit_id = issue.area.unit_id, 1.415 + }, 1.416 + content = _("change/revoke delegation of organizational unit", { 1.417 + unit_name = issue.area.unit.name 1.418 }) 1.419 } 1.420 end } 1.421 + elseif issue.member_info.own_delegation_scope == "area" then 1.422 + ui.tag { tag = "li", content = function () 1.423 + ui.link { 1.424 + module = "delegation", view = "show", params = { 1.425 + area_id = issue.area_id, 1.426 + }, 1.427 + content = _"change/revoke delegation of subject area" 1.428 + } 1.429 + end } 1.430 end 1.431 - ui.tag { tag = "li", content = function () 1.432 - ui.link { 1.433 - module = "interest", action = "update", 1.434 - routing = { default = { 1.435 - mode = "redirect", module = view_module, view = "show", id = view_id 1.436 - } }, 1.437 - params = { issue_id = issue.id, delete = true }, 1.438 - text = _"remove my interest" 1.439 - } 1.440 - end } 1.441 - end } 1.442 - end ) 1.443 - else 1.444 - ui.sidebarSection( function () 1.445 - ui.heading{ level = 3, content = _("I want to participate in this issue", { id = issue.id }) } 1.446 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.447 - ui.tag { tag = "li", content = function () 1.448 - ui.link { 1.449 - module = "interest", action = "update", 1.450 - params = { issue_id = issue.id }, 1.451 - routing = { default = { 1.452 - mode = "redirect", module = view_module, view = "show", id = view_id 1.453 - } }, 1.454 - text = _"add my interest" 1.455 - } 1.456 - end } 1.457 - ui.tag { tag = "li", content = _"browse through the competing initiatives" } 1.458 - end } 1.459 - end ) 1.460 - end 1.461 - 1.462 - if initiative then 1.463 - 1.464 - if not initiative.member_info.supported or active_trustee_id then 1.465 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.466 - ui.heading { level = 3, content = function() 1.467 - ui.tag { content = _"I like this initiative and I want to support it" } 1.468 - end } 1.469 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.470 + if issue.member_info.own_delegation_scope == nil then 1.471 + ui.tag { tag = "li", content = function () 1.472 + ui.link { 1.473 + module = "delegation", view = "show", params = { 1.474 + issue_id = issue.id, 1.475 + initiative_id = initiative and initiative.id or nil 1.476 + }, 1.477 + content = _"choose issue delegatee" 1.478 + } 1.479 + end } 1.480 + elseif issue.member_info.own_delegation_scope == "issue" then 1.481 ui.tag { tag = "li", content = function () 1.482 ui.link { 1.483 - module = "initiative", action = "add_support", 1.484 + module = "delegation", view = "show", params = { 1.485 + issue_id = issue.id, 1.486 + initiative_id = initiative and initiative.id or nil 1.487 + }, 1.488 + content = _"change/revoke issue delegation" 1.489 + } 1.490 + end } 1.491 + end 1.492 + if issue.member_info.first_trustee_id and issue.member_info.own_participation then 1.493 + local text = _"As long as you are interested in this issue yourself, the delegation is suspended for this issue, but it will be applied again in the voting phase unless you vote yourself." 1.494 + if issue.state == "voting" then 1.495 + text = _"This delegation is suspended, because you voted yourself." 1.496 + end 1.497 + ui.tag { tag = "li", content = function () 1.498 + ui.container { content = text } 1.499 + end } 1.500 + end 1.501 + 1.502 + end } 1.503 + 1.504 + end } 1.505 + end 1.506 + 1.507 + if not config.disable_delegations and privileged_to_vote and not issue.closed and not issue.fully_frozen then 1.508 + if issue.member_info.own_participation then 1.509 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.510 + --[[ 1.511 + ui.container{ attr = { class = "right" }, content = function() 1.512 + ui.image{ attr = { class = "right" }, static = "icons/48/eye.png" } 1.513 + if issue.member_info.weight and issue.member_info.weight > 1 then 1.514 + slot.put("<br />") 1.515 + ui.tag{ 1.516 + attr = { class = "right" }, 1.517 + content = "+" .. issue.member_info.weight - 1 1.518 + } 1.519 + end 1.520 + end } 1.521 + --]] 1.522 + ui.tag{ content = _("You are interested in this issue", { id = issue.id }) } 1.523 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.524 + if issue.member_info.weight and issue.member_info.weight > 1 then 1.525 + ui.tag { tag = "li", content = function () 1.526 + ui.link { 1.527 + module = "delegation", view = "show_incoming", 1.528 + params = { issue_id = issue.id, member_id = app.session.member_id }, 1.529 + content = _("you have #{count} incoming delegations", { 1.530 + count = issue.member_info.weight - 1 1.531 + }) 1.532 + } 1.533 + end } 1.534 + end 1.535 + ui.tag { tag = "li", content = function () 1.536 + ui.link { 1.537 + module = "interest", action = "update", 1.538 routing = { default = { 1.539 - mode = "redirect", module = "initiative", view = "show", id = initiative.id 1.540 + mode = "redirect", module = view_module, view = "show", id = view_id 1.541 } }, 1.542 - id = initiative.id, 1.543 - text = _"add my support" 1.544 + params = { issue_id = issue.id, delete = true }, 1.545 + text = _"remove my interest" 1.546 } 1.547 end } 1.548 end } 1.549 end } 1.550 - 1.551 - else -- if not supported 1.552 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.553 - if initiative.member_info.satisfied then 1.554 - ui.image{ attr = { class = "right icon48" }, static = "icons/32/support_satisfied.png" } 1.555 - else 1.556 - ui.image{ attr = { class = "right icon48" }, static = "icons/32/support_unsatisfied.png" } 1.557 - end 1.558 - ui.heading { level = 3, content = _"You are supporting this initiative" } 1.559 + else 1.560 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.561 + ui.tag{ content = _("I want to participate in this issue", { id = issue.id }) } 1.562 ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.563 - if not initiative.member_info.satisfied then 1.564 + ui.tag { tag = "li", content = function () 1.565 + ui.link { 1.566 + module = "interest", action = "update", 1.567 + params = { issue_id = issue.id }, 1.568 + routing = { default = { 1.569 + mode = "redirect", module = view_module, view = "show", id = view_id 1.570 + } }, 1.571 + text = _"add my interest" 1.572 + } 1.573 + end } 1.574 + ui.tag { tag = "li", content = _"browse through the competing initiatives" } 1.575 + end } 1.576 + end } 1.577 + end 1.578 + 1.579 + if initiative then 1.580 + 1.581 + if not initiative.member_info.supported or active_trustee_id then 1.582 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.583 + ui.tag { content = _"I like this initiative and I want to support it" } 1.584 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.585 ui.tag { tag = "li", content = function () 1.586 - ui.tag { content = function () 1.587 - ui.link { 1.588 - external = "#suggestions", 1.589 - content = _"you restricted your support by rating suggestions as must or must not" 1.590 - } 1.591 - end } 1.592 - end } 1.593 - end 1.594 - ui.tag { tag = "li", content = function () 1.595 - ui.tag { content = function () 1.596 ui.link { 1.597 - xattr = { class = "btn btn-remove" }, 1.598 - module = "initiative", action = "remove_support", 1.599 + module = "initiative", action = "add_support", 1.600 routing = { default = { 1.601 mode = "redirect", module = "initiative", view = "show", id = initiative.id 1.602 } }, 1.603 id = initiative.id, 1.604 - text = _"remove my support" 1.605 + text = _"add my support" 1.606 } 1.607 end } 1.608 end } 1.609 end } 1.610 - end } 1.611 - 1.612 - end -- not supported 1.613 - 1.614 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.615 - ui.heading { level = 3, content = _"I want to improve this initiative" } 1.616 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.617 - if issue.state == "verification" then 1.618 - ui.tag { tag = "li", content = _"this issue is in verification phase, therefore the initiative text cannot be updated anymore" } 1.619 - elseif issue.state == "voting" then 1.620 - ui.tag { tag = "li", content = _"this issue is in voting phase, therefore the initiative text cannot be updated anymore" } 1.621 - else 1.622 1.623 - if initiative.member_info.initiated then 1.624 - ui.tag { tag = "li", content =_"take a look at the suggestions of your supporters" } 1.625 - ui.tag { tag = "li", content =_"if you like to implement a suggestion in your proposal and/or reasons, update your initiative draft" } 1.626 - ui.tag { tag = "li", content =_"to argue about suggestions, just add your arguments to your reasons in the initiative draft, so your supporters can learn about your opinion" } 1.627 + else -- if not supported 1.628 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.629 + --[[ 1.630 + if initiative.member_info.satisfied then 1.631 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" } 1.632 + else 1.633 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" } 1.634 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "warning" } 1.635 end 1.636 - 1.637 - if not initiative.member_info.supported or active_trustee_id then 1.638 - ui.tag { tag = "li", content =_"add your support (see above) and rate or write new suggestions (and thereby restrict your support to certain conditions if necessary)" } 1.639 - else 1.640 - ui.tag { tag = "li", content = _"take a look at the suggestions (see left) and rate them" } 1.641 + --]] 1.642 + ui.tag{ content = _"You are supporting this initiative" } 1.643 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.644 + if not initiative.member_info.satisfied then 1.645 + ui.tag { tag = "li", content = function () 1.646 + ui.tag { content = function () 1.647 + ui.link { 1.648 + external = "#suggestions", 1.649 + content = _"you restricted your support by rating suggestions as must or must not" 1.650 + } 1.651 + end } 1.652 + end } 1.653 + end 1.654 ui.tag { tag = "li", content = function () 1.655 - ui.link { 1.656 - module = "suggestion", view = "new", params = { 1.657 - initiative_id = initiative.id 1.658 - }, 1.659 - content = _"write a new suggestion" 1.660 - } 1.661 + ui.tag { content = function () 1.662 + ui.link { 1.663 + xattr = { class = "btn btn-remove" }, 1.664 + module = "initiative", action = "remove_support", 1.665 + routing = { default = { 1.666 + mode = "redirect", module = "initiative", view = "show", id = initiative.id 1.667 + } }, 1.668 + id = initiative.id, 1.669 + text = _"remove my support" 1.670 + } 1.671 + end } 1.672 end } 1.673 + end } 1.674 + end } 1.675 + 1.676 + end -- not supported 1.677 + 1.678 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.679 + ui.tag{ content = _"I want to improve this initiative" } 1.680 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.681 + if issue.state == "verification" then 1.682 + ui.tag { tag = "li", content = _"this issue is in verification phase, therefore the initiative text cannot be updated anymore" } 1.683 + elseif issue.state == "voting" then 1.684 + ui.tag { tag = "li", content = _"this issue is in voting phase, therefore the initiative text cannot be updated anymore" } 1.685 + else 1.686 + 1.687 + if initiative.member_info.initiated then 1.688 + ui.tag { tag = "li", content =_"take a look at the suggestions of your supporters" } 1.689 + ui.tag { tag = "li", content =_"if you like to implement a suggestion in your proposal and/or reasons, update your initiative draft" } 1.690 + ui.tag { tag = "li", content =_"to argue about suggestions, just add your arguments to your reasons in the initiative draft, so your supporters can learn about your opinion" } 1.691 + end 1.692 + 1.693 + if not initiative.member_info.supported or active_trustee_id then 1.694 + ui.tag { tag = "li", content =_"add your support (see above) and rate or write new suggestions (and thereby restrict your support to certain conditions if necessary)" } 1.695 + else 1.696 + ui.tag { tag = "li", content = _"take a look at the suggestions (see right) and rate them" } 1.697 + ui.tag { tag = "li", content = function () 1.698 + ui.link { 1.699 + module = "suggestion", view = "new", params = { 1.700 + initiative_id = initiative.id 1.701 + }, 1.702 + content = _"write a new suggestion" 1.703 + } 1.704 + end } 1.705 + end 1.706 end 1.707 + end } 1.708 + end } 1.709 + 1.710 + end 1.711 + 1.712 + if 1.713 + (issue.state == "admission" or 1.714 + issue.state == "discussion" or 1.715 + issue.state == "verification") 1.716 + then 1.717 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.718 + if initiative then 1.719 + ui.tag{ content = _"I don't like this initiative and I want to add my opinion or counter proposal" } 1.720 + else 1.721 + ui.tag{ content = _"I don't like any of the initiative in this issue and I want to add my opinion or counter proposal" } 1.722 end 1.723 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.724 + ui.tag { tag = "li", content = function () 1.725 + ui.link { 1.726 + module = "issue", view = "show", id = issue.id, 1.727 + content = _"take a look at the competing initiatives" 1.728 + } 1.729 + end } 1.730 + ui.tag { tag = "li", content = function () 1.731 + ui.link { 1.732 + module = "initiative", view = "new", 1.733 + params = { issue_id = issue.id }, 1.734 + content = _"start a new competing initiative" 1.735 + } 1.736 + end } 1.737 + end } 1.738 end } 1.739 - end } 1.740 + end 1.741 1.742 end 1.743 1.744 - if 1.745 - (issue.state == "admission" or 1.746 - issue.state == "discussion" or 1.747 - issue.state == "verification") 1.748 - then 1.749 - ui.sidebarSection( function () 1.750 - if initiative then 1.751 - ui.heading{ level = 3, content = _"I don't like this initiative and I want to add my opinion or counter proposal" } 1.752 - else 1.753 - ui.heading{ level = 3, content = _"I don't like any of the initiative in this issue and I want to add my opinion or counter proposal" } 1.754 - end 1.755 + if not config.disable_delegations and privileged_to_vote and not issue.closed then 1.756 + 1.757 + if not issue.member_info.first_trustee_id then 1.758 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.759 + ui.tag{ content = _"I want to delegate this issue" } 1.760 + 1.761 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.762 + ui.tag { tag = "li", content = function () 1.763 + ui.link { 1.764 + module = "delegation", view = "show", params = { 1.765 + issue_id = issue.id, 1.766 + initiative_id = initiative and initiative.id or nil 1.767 + }, 1.768 + content = _"choose issue delegatee" 1.769 + } 1.770 + end } 1.771 + end } 1.772 + end } 1.773 + end 1.774 + 1.775 + end 1.776 + 1.777 + if initiator and initiator.accepted == false then 1.778 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.779 + ui.tag { content = _"You refused to become initiator of this initiative" } 1.780 ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.781 - ui.tag { tag = "li", content = function () 1.782 - ui.link { 1.783 - module = "issue", view = "show", id = issue.id, 1.784 - content = _"take a look at the competing initiatives" 1.785 - } 1.786 - end } 1.787 - ui.tag { tag = "li", content = function () 1.788 - ui.link { 1.789 - module = "initiative", view = "new", 1.790 - params = { issue_id = issue.id }, 1.791 - content = _"start a new competing initiative" 1.792 + ui.tag{ tag = "li", content = function () 1.793 + ui.link{ 1.794 + text = _"allow invitation again", 1.795 + module = "initiative", 1.796 + action = "remove_initiator", 1.797 + params = { 1.798 + initiative_id = initiative.id, 1.799 + member_id = app.session.member.id 1.800 + }, 1.801 + routing = { 1.802 + ok = { 1.803 + mode = "redirect", 1.804 + module = "initiative", 1.805 + view = "show", 1.806 + id = initiative.id 1.807 + } 1.808 + } 1.809 } 1.810 end } 1.811 end } 1.812 - end ) 1.813 - end 1.814 - 1.815 - end 1.816 - 1.817 - if privileged_to_vote and not issue.closed then 1.818 - 1.819 - if not issue.member_info.first_trustee_id then 1.820 - ui.sidebarSection( function () 1.821 - ui.heading{ level = 3, content = _"I want to delegate this issue" } 1.822 + end } 1.823 + end 1.824 1.825 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.826 - ui.tag { tag = "li", content = function () 1.827 - ui.link { 1.828 - module = "delegation", view = "show", params = { 1.829 - issue_id = issue.id, 1.830 - initiative_id = initiative and initiative.id or nil 1.831 - }, 1.832 - content = _"choose issue delegatee" 1.833 - } 1.834 - end } 1.835 - end } 1.836 - end ) 1.837 - end 1.838 + 1.839 1.840 - end 1.841 - 1.842 - if initiator and initiator.accepted == false then 1.843 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.844 - ui.heading { level = 3, content = function() 1.845 - ui.tag { content = _"You refused to become initiator of this initiative" } 1.846 - end } 1.847 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.848 - ui.tag{ tag = "li", content = function () 1.849 - ui.link{ 1.850 - text = _"allow invitation again", 1.851 - module = "initiative", 1.852 - action = "remove_initiator", 1.853 - params = { 1.854 - initiative_id = initiative.id, 1.855 - member_id = app.session.member.id 1.856 - }, 1.857 - routing = { 1.858 - ok = { 1.859 - mode = "redirect", 1.860 - module = "initiative", 1.861 - view = "show", 1.862 - id = initiative.id 1.863 - } 1.864 - } 1.865 - } 1.866 - end } 1.867 - end } 1.868 - end } 1.869 - end 1.870 - 1.871 - 1.872 - 1.873 - if privileged_to_vote then 1.874 - 1.875 - if initiative and 1.876 - (issue.state == "admission" or 1.877 - issue.state == "discussion" or 1.878 - issue.state == "verification") 1.879 - then 1.880 + if privileged_to_vote then 1.881 1.882 - elseif issue.state == "verification" then 1.883 - 1.884 - elseif issue.state == "voting" then 1.885 - if not issue.member_info.direct_voted then 1.886 - if not issue.member_info.non_voter then 1.887 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.888 - ui.heading { level = 3, content = _"I like to vote on this issue:" } 1.889 + if initiative and 1.890 + (issue.state == "admission" or 1.891 + issue.state == "discussion" or 1.892 + issue.state == "verification") 1.893 + then 1.894 + 1.895 + elseif issue.state == "verification" then 1.896 + 1.897 + elseif issue.state == "voting" then 1.898 + if not issue.member_info.direct_voted then 1.899 + if not issue.member_info.non_voter then 1.900 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.901 + ui.tag{ content = _"I like to vote on this issue:" } 1.902 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.903 + ui.tag { tag = "li", content = function () 1.904 + ui.tag { content = function () 1.905 + if not issue.closed then 1.906 + ui.link { 1.907 + xattr = { class = "btn btn-vote" }, 1.908 + module = "vote", view = "list", 1.909 + params = { issue_id = issue.id }, 1.910 + text = _"vote now" 1.911 + } 1.912 + end 1.913 + end } 1.914 + end } 1.915 + end } 1.916 + end } 1.917 + end 1.918 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.919 + if not issue.member_info.non_voter then 1.920 + ui.tag{ content = _"I don't like to vote this issue (myself):" } 1.921 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.922 + ui.tag { tag = "li", content = function () 1.923 + ui.link{ 1.924 + content = _"do not notify me about this voting anymore", 1.925 + module = "vote", 1.926 + action = "non_voter", 1.927 + params = { issue_id = issue.id }, 1.928 + routing = { 1.929 + default = { 1.930 + mode = "redirect", 1.931 + module = request.get_module(), 1.932 + view = request.get_view(), 1.933 + id = request.get_id_string(), 1.934 + params = request.get_param_strings() 1.935 + } 1.936 + } 1.937 + } 1.938 + end } 1.939 + end } 1.940 + else 1.941 + ui.tag{ content = _"You do not like to vote this issue (yourself)" } 1.942 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.943 + ui.tag { tag = "li", content = function () 1.944 + ui.link{ 1.945 + in_brackets = true, 1.946 + content = _"discard", 1.947 + module = "vote", 1.948 + action = "non_voter", 1.949 + params = { issue_id = issue.id, delete = true }, 1.950 + routing = { 1.951 + default = { 1.952 + mode = "redirect", 1.953 + module = request.get_module(), 1.954 + view = request.get_view(), 1.955 + id = request.get_id_string(), 1.956 + params = request.get_param_strings() 1.957 + } 1.958 + } 1.959 + } 1.960 + end } 1.961 + end } 1.962 + end 1.963 + end } 1.964 + else 1.965 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.966 + ui.tag{ content = _"I like to change/revoke my vote:" } 1.967 ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.968 ui.tag { tag = "li", content = function () 1.969 ui.tag { content = function () 1.970 @@ -509,131 +578,73 @@ 1.971 xattr = { class = "btn btn-vote" }, 1.972 module = "vote", view = "list", 1.973 params = { issue_id = issue.id }, 1.974 - text = _"vote now" 1.975 + text = _"change my vote" 1.976 + } 1.977 + end 1.978 + end } 1.979 + end } 1.980 + ui.tag { tag = "li", content = function () 1.981 + ui.tag { content = function () 1.982 + if not issue.closed then 1.983 + ui.link { 1.984 + module = "vote", action = "update", 1.985 + params = { 1.986 + issue_id = issue.id, 1.987 + discard = true 1.988 + }, 1.989 + routing = { 1.990 + default = { 1.991 + mode = "redirect", 1.992 + module = "issue", 1.993 + view = "show", 1.994 + id = issue.id 1.995 + } 1.996 + }, 1.997 + text = _"discard my vote" 1.998 } 1.999 end 1.1000 end } 1.1001 end } 1.1002 - end } 1.1003 - end } 1.1004 + end } 1.1005 + 1.1006 + end } 1.1007 + 1.1008 end 1.1009 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.1010 - if not issue.member_info.non_voter then 1.1011 - ui.heading { level = 3, content = _"I don't like to vote this issue (myself):" } 1.1012 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.1013 - ui.tag { tag = "li", content = function () 1.1014 - ui.link{ 1.1015 - content = _"do not notify me about this voting anymore", 1.1016 - module = "vote", 1.1017 - action = "non_voter", 1.1018 - params = { issue_id = issue.id }, 1.1019 - routing = { 1.1020 - default = { 1.1021 - mode = "redirect", 1.1022 - module = request.get_module(), 1.1023 - view = request.get_view(), 1.1024 - id = request.get_id_string(), 1.1025 - params = request.get_param_strings() 1.1026 - } 1.1027 - } 1.1028 - } 1.1029 - end } 1.1030 - end } 1.1031 - else 1.1032 - ui.heading { level = 3, content = _"You do not like to vote this issue (yourself)" } 1.1033 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.1034 - ui.tag { tag = "li", content = function () 1.1035 - ui.link{ 1.1036 - in_brackets = true, 1.1037 - content = _"discard", 1.1038 - module = "vote", 1.1039 - action = "non_voter", 1.1040 - params = { issue_id = issue.id, delete = true }, 1.1041 - routing = { 1.1042 - default = { 1.1043 - mode = "redirect", 1.1044 - module = request.get_module(), 1.1045 - view = request.get_view(), 1.1046 - id = request.get_id_string(), 1.1047 - params = request.get_param_strings() 1.1048 - } 1.1049 - } 1.1050 - } 1.1051 - end } 1.1052 + end 1.1053 + end 1.1054 + 1.1055 + if not app.session.member or not privileged_to_vote then 1.1056 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.1057 + ui.tag{ content = _"You are not entitled to vote in this unit" } 1.1058 + ui.tag{ tag = "ul", content = function() 1.1059 + ui.tag{ tag = "li", content = function() 1.1060 + ui.link{ module = "index", view = "login", content = _"Login" } 1.1061 + end } 1.1062 + end } 1.1063 + end } 1.1064 + end 1.1065 + 1.1066 + if issue.closed then 1.1067 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.1068 + ui.tag { content = _"This issue is closed" } 1.1069 + end } 1.1070 + end 1.1071 + 1.1072 + if initiative and config.tell_others and config.tell_others.initiative then 1.1073 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.1074 + 1.1075 + ui.heading { level = 3, content = _"Tell others about this initiative:" } 1.1076 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.1077 + 1.1078 + for i, link in ipairs (config.tell_others.initiative(initiative)) do 1.1079 + ui.tag { tag = "li", content = function () 1.1080 + ui.link ( link ) 1.1081 end } 1.1082 end 1.1083 + 1.1084 end } 1.1085 - else 1.1086 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.1087 - ui.heading { level = 3, content = _"I like to change/revoke my vote:" } 1.1088 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.1089 - ui.tag { tag = "li", content = function () 1.1090 - ui.tag { content = function () 1.1091 - if not issue.closed then 1.1092 - ui.link { 1.1093 - xattr = { class = "btn btn-vote" }, 1.1094 - module = "vote", view = "list", 1.1095 - params = { issue_id = issue.id }, 1.1096 - text = _"change my vote" 1.1097 - } 1.1098 - end 1.1099 - end } 1.1100 - end } 1.1101 - ui.tag { tag = "li", content = function () 1.1102 - ui.tag { content = function () 1.1103 - if not issue.closed then 1.1104 - ui.link { 1.1105 - module = "vote", action = "update", 1.1106 - params = { 1.1107 - issue_id = issue.id, 1.1108 - discard = true 1.1109 - }, 1.1110 - routing = { 1.1111 - default = { 1.1112 - mode = "redirect", 1.1113 - module = "issue", 1.1114 - view = "show", 1.1115 - id = issue.id 1.1116 - } 1.1117 - }, 1.1118 - text = _"discard my vote" 1.1119 - } 1.1120 - end 1.1121 - end } 1.1122 - end } 1.1123 - end } 1.1124 - 1.1125 - end } 1.1126 - 1.1127 - end 1.1128 + end } 1.1129 end 1.1130 - end 1.1131 - 1.1132 - if app.session.member and not privileged_to_vote then 1.1133 - ui.sidebarSection( _"You are not entitled to vote in this unit" ) 1.1134 - end 1.1135 - 1.1136 - if issue.closed then 1.1137 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.1138 - ui.heading { level = 3, content = _"This issue is closed" } 1.1139 - end } 1.1140 - end 1.1141 + end } 1.1142 1.1143 - if initiative and config.tell_others and config.tell_others.initiative then 1.1144 - ui.container { attr = { class = "sidebarRow" }, content = function () 1.1145 - 1.1146 - ui.heading { level = 3, content = _"Tell others about this initiative:" } 1.1147 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.1148 - 1.1149 - for i, link in ipairs (config.tell_others.initiative(initiative)) do 1.1150 - ui.tag { tag = "li", content = function () 1.1151 - ui.link ( link ) 1.1152 - end } 1.1153 - end 1.1154 - 1.1155 - end } 1.1156 - end } 1.1157 - end 1.1158 - 1.1159 - 1.1160 -end ) 1.1161 +end }