liquid_feedback_frontend

changeset 1623:22398d337507

Show delegation info only when voting or initiative privilege is given
author bsw
date Sat Feb 06 23:34:53 2021 +0100 (2021-02-06)
parents 72442abafb3c
children 6a332e93e1f8
files app/main/index/_head.lua
line diff
     1.1 --- a/app/main/index/_head.lua	Sat Feb 06 23:30:20 2021 +0100
     1.2 +++ b/app/main/index/_head.lua	Sat Feb 06 23:34:53 2021 +0100
     1.3 @@ -37,7 +37,10 @@
     1.4      end }
     1.5  
     1.6  
     1.7 -    if not (config.voting_only and config.disable_delegations) and app.session.member_id then
     1.8 +    if not (config.voting_only and config.disable_delegations) and app.session.member_id and (
     1.9 +      app.session.member:has_voting_right_for_unit_id(unit.id) 
    1.10 +      or app.session.member:has_initiative_right_for_unit_id(unit.id) 
    1.11 +    ) then
    1.12        ui.container{ attr = { class = "mdl-card__actions" }, content = function()
    1.13            
    1.14          unit:load_delegation_info_once_for_member_id(app.session.member_id)
    1.15 @@ -82,7 +85,10 @@
    1.16          end
    1.17        end }
    1.18      end
    1.19 -    if not (config.voting_only and config.disable_delegations) and app.session.member_id then
    1.20 +    if not (config.voting_only and config.disable_delegations) and app.session.member_id and (
    1.21 +      app.session.member:has_voting_right_for_unit_id(area.unit_id) 
    1.22 +      or app.session.member:has_initiative_right_for_unit_id(area.unit_id) 
    1.23 +    ) then
    1.24        ui.container{ attr = { class = "mdl-card__actions" }, content = function()
    1.25            
    1.26          area:load_delegation_info_once_for_member_id(app.session.member_id)
    1.27 @@ -90,14 +96,18 @@
    1.28          local text
    1.29          if area.delegation_info.own_delegation_scope == "area" then
    1.30            local member = Member:by_id(area.delegation_info.first_trustee_id)
    1.31 -          ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
    1.32 -          execute.view{
    1.33 -            module = "member",
    1.34 -            view = "_show_thumb",
    1.35 -            params = {
    1.36 -              member = member
    1.37 +          if member then
    1.38 +            ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
    1.39 +            execute.view{
    1.40 +              module = "member",
    1.41 +              view = "_show_thumb",
    1.42 +              params = {
    1.43 +                member = member
    1.44 +              }
    1.45              }
    1.46 -          }
    1.47 +          else
    1.48 +            ui.tag{ content = _"Delegation abandoned" }
    1.49 +          end
    1.50            text = _"change delegation..."
    1.51          else
    1.52            text = _"delegate..."  

Impressum / About Us