liquid_feedback_frontend

diff app/main/index/_head.lua @ 1596:9f55297a1a6a

Reworked subject area delegation buttons
author bsw
date Sun Jan 31 20:35:05 2021 +0100 (2021-01-31)
parents 3c15fea3f1c0
children 6b203b43bef3
line diff
     1.1 --- a/app/main/index/_head.lua	Sun Jan 31 20:34:37 2021 +0100
     1.2 +++ b/app/main/index/_head.lua	Sun Jan 31 20:35:05 2021 +0100
     1.3 @@ -14,10 +14,7 @@
     1.4  if area_id then
     1.5    area = Area:by_id(area_id)
     1.6  end
     1.7 -if area and unit and area.unit_id ~= unit.id then
     1.8 -  area_id = nil
     1.9 -end
    1.10 -if area and area.unit_id == unit_id then
    1.11 +if area then
    1.12    if app.session.member_id then
    1.13      area:load_delegation_info_once_for_member_id(app.session.member_id)
    1.14    end
    1.15 @@ -26,7 +23,7 @@
    1.16      if unit then
    1.17        ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    1.18          if not config.single_area_id then
    1.19 -          ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name .. " / " .. area.name }
    1.20 +          ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name .. " ยป " .. area.name }
    1.21          else
    1.22            ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name }
    1.23          end
    1.24 @@ -42,77 +39,55 @@
    1.25      if not (config.voting_only and config.disable_delegations) and app.session.member_id then
    1.26        ui.container{ attr = { class = "mdl-card__actions" }, content = function()
    1.27            
    1.28 -        if app.session.member_id then
    1.29 +        if not config.disable_delegations then
    1.30 +
    1.31            if area.delegation_info.first_trustee_id then
    1.32 -              local member = Member:by_id(area.delegation_info.first_trustee_id)
    1.33 -              ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
    1.34 -              execute.view{
    1.35 -                module = "member_image",
    1.36 -                view = "_show",
    1.37 -                params = {
    1.38 -                  member = member,
    1.39 -                  image_type = "avatar",
    1.40 -                  show_dummy = true
    1.41 -                }
    1.42 +            local member = Member:by_id(area.delegation_info.first_trustee_id)
    1.43 +            ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
    1.44 +            execute.view{
    1.45 +              module = "member",
    1.46 +              view = "_show_thumb",
    1.47 +              params = {
    1.48 +                member = member
    1.49                }
    1.50 +            }
    1.51            end
    1.52 +            
    1.53 +          local text
    1.54 +          if area.delegation_info.own_delegation_scope == nil then
    1.55 +            text = _"delegate..."  
    1.56 +          else
    1.57 +            text = _"change delegation..."
    1.58 +          end
    1.59 +          
    1.60 +          
    1.61 +          ui.tag{ attr = { id = "change_delegation", class = "mdl-button" }, content = text }
    1.62  
    1.63 -          if not config.disable_delegations then
    1.64 -            if area.delegation_info.own_delegation_scope == "unit" then
    1.65 +
    1.66 +          ui.tag { tag = "ul", attr = { class = "mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect", ["for"] = "change_delegation" }, content = function()
    1.67 +
    1.68 +            ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function()
    1.69                ui.link {
    1.70 -                attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
    1.71 +                attr = { class = "mdl-menu__link" },
    1.72                  module = "delegation", view = "show", params = {
    1.73                    unit_id = area.unit_id,
    1.74                  },
    1.75 -                content = _("change/revoke delegation of organizational unit")
    1.76 +                content = _("unit: #{name}", { name = area.unit.name })
    1.77                }
    1.78 -              slot.put("   ")
    1.79 -            end
    1.80 -            if area.delegation_info.own_delegation_scope == nil then
    1.81 -              local text
    1.82 -              if config.single_area_id then
    1.83 -                text = _"choose delegatee"  
    1.84 -              else
    1.85 -                text = _"choose subject area delegatee"  
    1.86 -              end
    1.87 +            end }
    1.88 +
    1.89 +            ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function()
    1.90                ui.link {
    1.91 -                attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
    1.92 +                attr = { class = "mdl-menu__link" },
    1.93                  module = "delegation", view = "show", params = {
    1.94                    area_id = area.id
    1.95                  },
    1.96 -                content = function()
    1.97 -                  ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
    1.98 -                  ui.tag{ content = text }
    1.99 -                end
   1.100 +                content = _("subject area: #{name}", { name = area.name })
   1.101                }
   1.102 -              slot.put("   ")
   1.103 -            elseif area.delegation_info.own_delegation_scope == "area" then
   1.104 -              local text
   1.105 -              if config.single_area_id then
   1.106 -                text = _"change/revoke delegation" 
   1.107 -              else
   1.108 -                text = _"change/revoke area delegation" 
   1.109 -              end
   1.110 -              ui.link {
   1.111 -                attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
   1.112 -                module = "delegation", view = "show", params = {
   1.113 -                  area_id = area.id
   1.114 -                },
   1.115 -                content = text
   1.116 -              }
   1.117 -              slot.put("   ")
   1.118 -            else
   1.119 -              ui.link {
   1.120 -                attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
   1.121 -                module = "delegation", view = "show", params = {
   1.122 -                  area_id = area.id
   1.123 -                },
   1.124 -                content = _"change/revoke delegation only for this subject area" 
   1.125 -              }
   1.126 -              slot.put("   ")
   1.127 -            end
   1.128 -          end
   1.129 +            end }
   1.130 +          end }
   1.131          end
   1.132 +                
   1.133          if not config.voting_only and app.session.member_id and app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then
   1.134            ui.link {
   1.135              attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },

Impressum / About Us