liquid_feedback_frontend
diff app/main/area/_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 | 84f6e17c7ceb |
| children | 473d372c6ec7 |
line diff
1.1 --- a/app/main/area/_sidebar_whatcanido.lua Thu Jun 23 03:30:57 2016 +0200 1.2 +++ b/app/main/area/_sidebar_whatcanido.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -1,10 +1,9 @@ 1.4 -local member = param.get ( "member", "table" ) or app.session.member 1.5 - 1.6 local area = param.get ( "area", "table" ) 1.7 +area:load_delegation_info_once_for_member_id(app.session.member_id) 1.8 1.9 local participating_trustee_id 1.10 local participating_trustee_name 1.11 -if member then 1.12 +if app.session.member then 1.13 if area.delegation_info.first_trustee_participation then 1.14 participating_trustee_id = area.delegation_info.first_trustee_id 1.15 participating_trustee_name = area.delegation_info.first_trustee_name 1.16 @@ -14,232 +13,192 @@ 1.17 end 1.18 end 1.19 1.20 -ui.sidebar ( "tab-whatcanido", function () 1.21 +ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() 1.22 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.23 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"What can I do here?" } 1.24 + end } 1.25 + ui.container{ attr = { class = "what-can-i-do-here" }, content = function() 1.26 1.27 - ui.sidebarHeadWhatCanIDo() 1.28 - 1.29 - if member and not app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.30 - ui.sidebarSection( _"You are not entitled to vote in this unit" ) 1.31 - end 1.32 - 1.33 - if member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.34 + if app.session.member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.35 1.36 - if not app.session.member.disable_notifications then 1.37 - 1.38 - local ignored_area = IgnoredArea:by_pk(app.session.member_id, area.id) 1.39 + if not app.session.member.disable_notifications then 1.40 + 1.41 + local ignored_area = IgnoredArea:by_pk(app.session.member_id, area.id) 1.42 1.43 - if not ignored_area then 1.44 - ui.sidebarSection ( function () 1.45 - 1.46 - ui.heading { 1.47 - level = 3, 1.48 - content = _"You are receiving updates by email for this subject area" 1.49 - } 1.50 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.51 - ui.tag { tag = "li", content = function () 1.52 - ui.tag { content = function () 1.53 - ui.link { 1.54 - module = "area", action = "update_ignore", 1.55 - params = { area_id = area.id }, 1.56 - routing = { default = { 1.57 - mode = "redirect", module = "area", view = "show", id = area.id 1.58 - } }, 1.59 - text = _"unsubscribe from update emails about this area" 1.60 - } 1.61 + if not ignored_area then 1.62 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.63 + ui.tag{ content = _"You are receiving updates by email for this subject area" } 1.64 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.65 + ui.tag { tag = "li", content = function () 1.66 + ui.tag { content = function () 1.67 + ui.link { 1.68 + module = "area", action = "update_ignore", 1.69 + params = { area_id = area.id }, 1.70 + routing = { default = { 1.71 + mode = "redirect", module = "index", view = "index", params = { unit = area.unit_id, area = area.id } 1.72 + } }, 1.73 + text = _"unsubscribe from update emails about this area" 1.74 + } 1.75 + end } 1.76 end } 1.77 end } 1.78 end } 1.79 - end ) 1.80 - end 1.81 + end 1.82 + 1.83 + if ignored_area then 1.84 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.85 + ui.tag{ content = _"I want to stay informed" } 1.86 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.87 + ui.tag { tag = "li", content = function () 1.88 + ui.tag { content = function () 1.89 + ui.link { 1.90 + module = "area", action = "update_ignore", 1.91 + params = { area_id = area.id, delete = true }, 1.92 + routing = { default = { 1.93 + mode = "redirect", module = "index", view = "index", params = { unit = area.unit_id, area = area.id } 1.94 + } }, 1.95 + text = _"subscribe for update emails about this area" 1.96 + } 1.97 + end } 1.98 + end } 1.99 + end } 1.100 + end } 1.101 + end 1.102 1.103 - if ignored_area then 1.104 - ui.sidebarSection ( function () 1.105 - 1.106 - ui.heading { 1.107 - level = 3, 1.108 - content = _"I want to stay informed" 1.109 - } 1.110 + else 1.111 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.112 + ui.tag{ content = _"I want to stay informed about this subject area" } 1.113 ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.114 ui.tag { tag = "li", content = function () 1.115 ui.tag { content = function () 1.116 + ui.tag{ content = _"Edit your global " } 1.117 ui.link { 1.118 - module = "area", action = "update_ignore", 1.119 - params = { area_id = area.id, delete = true }, 1.120 - routing = { default = { 1.121 - mode = "redirect", module = "area", view = "show", id = area.id 1.122 - } }, 1.123 - text = _"subscribe for update emails about this area" 1.124 + module = "member", view = "settings_notification", 1.125 + params = { return_to = "area", return_to_area_id = area.id }, 1.126 + text = _"notification settings" 1.127 } 1.128 + ui.tag{ content = _" to receive updates by email" } 1.129 end } 1.130 end } 1.131 end } 1.132 - end ) 1.133 - end 1.134 - 1.135 - else 1.136 - ui.sidebarSection ( function () 1.137 - 1.138 - ui.heading { 1.139 - level = 3, 1.140 - content = _"I want to stay informed about this subject area" 1.141 - } 1.142 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.143 - ui.tag { tag = "li", content = function () 1.144 - ui.tag { content = function () 1.145 - ui.tag{ content = _"Edit your global " } 1.146 - ui.link { 1.147 - module = "member", view = "settings_notification", 1.148 - params = { return_to = "area", return_to_area_id = area.id }, 1.149 - text = _"notification settings" 1.150 - } 1.151 - ui.tag{ content = _" to receive updates by email" } 1.152 - end } 1.153 - end } 1.154 - end } 1.155 - end ) 1.156 - end 1.157 - 1.158 - if area.delegation_info.own_participation then 1.159 - ui.sidebarSection ( function () 1.160 - ui.image{ attr = { class = "right" }, static = "icons/48/star.png" } 1.161 - ui.heading { 1.162 - level = 3, 1.163 - content = _"You are subscribed for this subject area" 1.164 - } 1.165 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.166 - ui.tag { tag = "li", content = function () 1.167 - ui.tag { content = function () 1.168 - ui.link { 1.169 - module = "membership", action = "update", 1.170 - routing = { default = { 1.171 - mode = "redirect", module = "area", view = "show", id = area.id 1.172 - } }, 1.173 - params = { area_id = area.id, delete = true }, 1.174 - text = _"unsubscribe" 1.175 - } 1.176 - end } 1.177 - end } 1.178 end } 1.179 - end ) 1.180 - end 1.181 - 1.182 - if not area.delegation_info.own_participation then 1.183 - ui.sidebarSection ( function () 1.184 + end 1.185 1.186 - ui.heading { 1.187 - level = 3, 1.188 - content = _"I want to participate in this subject area" 1.189 - } 1.190 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.191 - ui.tag { tag = "li", content = function () 1.192 - ui.tag { content = function () 1.193 - ui.link { 1.194 - module = "membership", action = "update", 1.195 - routing = { default = { 1.196 - mode = "redirect", module = "area", view = "show", id = area.id 1.197 - } }, 1.198 - params = { area_id = area.id }, 1.199 - text = _"subscribe" 1.200 - } 1.201 - end } 1.202 + if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then 1.203 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.204 + ui.tag{ content = _"I want to vote" } 1.205 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.206 + ui.tag { tag = "li", content = _"check the issues on the right, and click on 'Vote now' to vote on an issue which is in voting phase." } 1.207 end } 1.208 end } 1.209 - end ) 1.210 - end 1.211 + end 1.212 + 1.213 + if app.session.member and not app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.214 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = _"You are not entitled to vote in this unit" } 1.215 + end 1.216 1.217 - 1.218 - 1.219 - ui.sidebarSection ( function () 1.220 - 1.221 + if app.session.member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.222 + 1.223 + if not config.disable_delegations then 1.224 + 1.225 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.226 + 1.227 + if not area.delegation_info.first_trustee_id then 1.228 + ui.tag{ content = _"I want to delegate this subject area" } 1.229 + else 1.230 + ui.container { attr = { class = "right" }, content = function() 1.231 + local member = Member:by_id(area.delegation_info.first_trustee_id) 1.232 + execute.view{ 1.233 + module = "member_image", 1.234 + view = "_show", 1.235 + params = { 1.236 + member = member, 1.237 + image_type = "avatar", 1.238 + show_dummy = true 1.239 + } 1.240 + } 1.241 + end } 1.242 + ui.tag{ content = _"You delegated this subject area" } 1.243 + end 1.244 1.245 - if not area.delegation_info.first_trustee_id then 1.246 - ui.heading{ level = 3, content = _"I want to delegate this subject area" } 1.247 - else 1.248 - ui.container { attr = { class = "right" }, content = function() 1.249 - local member = Member:by_id(area.delegation_info.first_trustee_id) 1.250 - execute.view{ 1.251 - module = "member_image", 1.252 - view = "_show", 1.253 - params = { 1.254 - member = member, 1.255 - image_type = "avatar", 1.256 - show_dummy = true 1.257 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.258 + if area.delegation_info.own_delegation_scope == "unit" then 1.259 + ui.tag { tag = "li", content = function () 1.260 + ui.link { 1.261 + module = "delegation", view = "show", params = { 1.262 + unit_id = area.unit_id, 1.263 + }, 1.264 + content = _("change/revoke delegation of organizational unit") 1.265 + } 1.266 + end } 1.267 + end 1.268 + 1.269 + if area.delegation_info.own_delegation_scope == nil then 1.270 + ui.tag { tag = "li", content = function () 1.271 + ui.link { 1.272 + module = "delegation", view = "show", params = { 1.273 + area_id = area.id 1.274 + }, 1.275 + content = _"choose subject area delegatee" 1.276 + } 1.277 + end } 1.278 + elseif area.delegation_info.own_delegation_scope == "area" then 1.279 + ui.tag { tag = "li", content = function () 1.280 + ui.link { 1.281 + module = "delegation", view = "show", params = { 1.282 + area_id = area.id 1.283 + }, 1.284 + content = _"change/revoke area delegation" 1.285 + } 1.286 + end } 1.287 + else 1.288 + ui.tag { tag = "li", content = function () 1.289 + ui.link { 1.290 + module = "delegation", view = "show", params = { 1.291 + area_id = area.id 1.292 + }, 1.293 + content = _"change/revoke delegation only for this subject area" 1.294 + } 1.295 + end } 1.296 + end 1.297 + end } 1.298 + end } 1.299 + end 1.300 + 1.301 + if app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then 1.302 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.303 + ui.tag{ 1.304 + content = _("I want to start a new initiative", { 1.305 + area_name = area.name 1.306 + } ) 1.307 } 1.308 - } 1.309 - end } 1.310 - ui.heading{ level = 3, content = _"You delegated this subject area" } 1.311 - end 1.312 - 1.313 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.314 - if area.delegation_info.own_delegation_scope == "unit" then 1.315 - ui.tag { tag = "li", content = function () 1.316 - ui.link { 1.317 - module = "delegation", view = "show", params = { 1.318 - unit_id = area.unit_id, 1.319 - }, 1.320 - content = _("change/revoke delegation of organizational unit") 1.321 - } 1.322 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.323 + ui.tag { tag = "li", content = _"Take a look through the existing issues. Maybe someone else started a debate on your topic (and you can join it) or the topic has been decided already in the past." } 1.324 + ui.tag { tag = "li", content = function () 1.325 + ui.tag { content = function () 1.326 + ui.tag { content = _"If you cannot find any appropriate existing issue, " } 1.327 + ui.link { 1.328 + module = "initiative", view = "new", 1.329 + params = { area_id = area.id }, 1.330 + text = _"start an initiative in a new issue" 1.331 + } 1.332 + end } 1.333 + end } 1.334 + end } 1.335 end } 1.336 end 1.337 - 1.338 - if area.delegation_info.own_delegation_scope == nil then 1.339 - ui.tag { tag = "li", content = function () 1.340 - ui.link { 1.341 - module = "delegation", view = "show", params = { 1.342 - area_id = area.id 1.343 - }, 1.344 - content = _"choose subject area delegatee" 1.345 - } 1.346 - end } 1.347 - elseif area.delegation_info.own_delegation_scope == "area" then 1.348 - ui.tag { tag = "li", content = function () 1.349 - ui.link { 1.350 - module = "delegation", view = "show", params = { 1.351 - area_id = area.id 1.352 - }, 1.353 - content = _"change/revoke area delegation" 1.354 - } 1.355 - end } 1.356 - else 1.357 - ui.tag { tag = "li", content = function () 1.358 - ui.link { 1.359 - module = "delegation", view = "show", params = { 1.360 - area_id = area.id 1.361 - }, 1.362 - content = _"change/revoke delegation only for this subject area" 1.363 - } 1.364 - end } 1.365 - end 1.366 - end } 1.367 - end ) 1.368 - 1.369 - 1.370 - 1.371 - 1.372 - if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then 1.373 - ui.sidebarSection ( function () 1.374 - ui.heading { 1.375 - level = 3, 1.376 - content = _("I want to start a new initiative", { 1.377 - area_name = area.name 1.378 - } ) 1.379 - } 1.380 - ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.381 - ui.tag { tag = "li", content = _"Take a look through the existing issues. Maybe someone else started a debate on your topic (and you can join it) or the topic has been decided already in the past." } 1.382 - ui.tag { tag = "li", content = function () 1.383 - ui.tag { content = function () 1.384 - ui.tag { content = _"If you cannot find any appropriate existing issue, " } 1.385 - ui.link { 1.386 - module = "initiative", view = "new", 1.387 - params = { area_id = area.id }, 1.388 - text = _"start an initiative in a new issue" 1.389 - } 1.390 - end } 1.391 + 1.392 + end 1.393 + else 1.394 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function () 1.395 + ui.tag{ content = _"You are not entitled to vote in this unit" } 1.396 + ui.tag{ tag = "ul", content = function() 1.397 + ui.tag{ tag = "li", content = function() 1.398 + ui.link{ module = "index", view = "login", content = _"Login" } 1.399 end } 1.400 end } 1.401 - end ) 1.402 + end } 1.403 end 1.404 - else 1.405 - end 1.406 + end } 1.407 1.408 -end ) 1.409 \ No newline at end of file 1.410 +end }