liquid_feedback_frontend

diff app/main/index/_head.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
children 3ab878ba277e
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/index/_head.lua	Sun Jul 15 14:07:29 2018 +0200
     1.3 @@ -0,0 +1,142 @@
     1.4 +local unit_id = config.single_unit_id or tonumber(request.get_param{ name = "unit" })
     1.5 +if unit_id == "all" then
     1.6 +  unit_id = nil 
     1.7 +end
     1.8 +local unit
     1.9 +if unit_id then
    1.10 +  unit = Unit:by_id(unit_id)
    1.11 +end
    1.12 +local area_id = config.single_area_id or tonumber(request.get_param{ name = "area" })
    1.13 +if area_id == "all" then
    1.14 +  area_id = nil
    1.15 +end
    1.16 +local area
    1.17 +if area_id then
    1.18 +  area = Area:by_id(area_id)
    1.19 +end
    1.20 +if area and unit and area.unit_id ~= unit.id then
    1.21 +  area_id = nil
    1.22 +end
    1.23 +if area and area.unit_id == unit_id then
    1.24 +  if app.session.member_id then
    1.25 +    area:load_delegation_info_once_for_member_id(app.session.member_id)
    1.26 +  end
    1.27 +
    1.28 +  ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
    1.29 +    if unit then
    1.30 +      ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    1.31 +        if not config.single_area_id then
    1.32 +          ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name .. " / " .. area.name }
    1.33 +        else
    1.34 +          ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name }
    1.35 +        end
    1.36 +      end }
    1.37 +    end
    1.38 +    if area.description and #(area.description) > 0 then
    1.39 +      if not config.single_area_id then
    1.40 +        ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = area.description }
    1.41 +      else
    1.42 +        ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = unit.description }
    1.43 +      end
    1.44 +    end
    1.45 +    if not (config.voting_only and config.disable_delegations) and app.session.member_id then
    1.46 +      ui.container{ attr = { class = "mdl-card__actions" }, content = function()
    1.47 +          
    1.48 +        if app.session.member_id then
    1.49 +          if area.delegation_info.first_trustee_id then
    1.50 +              local member = Member:by_id(area.delegation_info.first_trustee_id)
    1.51 +              ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
    1.52 +              execute.view{
    1.53 +                module = "member_image",
    1.54 +                view = "_show",
    1.55 +                params = {
    1.56 +                  member = member,
    1.57 +                  image_type = "avatar",
    1.58 +                  show_dummy = true
    1.59 +                }
    1.60 +              }
    1.61 +          end
    1.62 +
    1.63 +          if not config.disable_delegations then
    1.64 +            if area.delegation_info.own_delegation_scope == "unit" then
    1.65 +              ui.link {
    1.66 +                attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
    1.67 +                module = "delegation", view = "show", params = {
    1.68 +                  unit_id = area.unit_id,
    1.69 +                },
    1.70 +                content = _("change/revoke delegation of organizational unit")
    1.71 +              }
    1.72 +              slot.put("   ")
    1.73 +            end
    1.74 +            if area.delegation_info.own_delegation_scope == nil then
    1.75 +              local text
    1.76 +              if config.single_area_id then
    1.77 +                text = _"choose delegatee"  
    1.78 +              else
    1.79 +                text = _"choose subject area delegatee"  
    1.80 +              end
    1.81 +              ui.link {
    1.82 +                attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
    1.83 +                module = "delegation", view = "show", params = {
    1.84 +                  area_id = area.id
    1.85 +                },
    1.86 +                content = function()
    1.87 +                  ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
    1.88 +                  ui.tag{ content = text }
    1.89 +                end
    1.90 +              }
    1.91 +              slot.put("   ")
    1.92 +            elseif area.delegation_info.own_delegation_scope == "area" then
    1.93 +              local text
    1.94 +              if config.single_area_id then
    1.95 +                text = _"change/revoke delegation" 
    1.96 +              else
    1.97 +                text = _"change/revoke area delegation" 
    1.98 +              end
    1.99 +              ui.link {
   1.100 +                attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
   1.101 +                module = "delegation", view = "show", params = {
   1.102 +                  area_id = area.id
   1.103 +                },
   1.104 +                content = text
   1.105 +              }
   1.106 +              slot.put("   ")
   1.107 +            else
   1.108 +              ui.link {
   1.109 +                attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
   1.110 +                module = "delegation", view = "show", params = {
   1.111 +                  area_id = area.id
   1.112 +                },
   1.113 +                content = _"change/revoke delegation only for this subject area" 
   1.114 +              }
   1.115 +              slot.put("   ")
   1.116 +            end
   1.117 +          end
   1.118 +        end
   1.119 +        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.120 +          ui.link {
   1.121 +            attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
   1.122 +            module = "initiative", view = "new",
   1.123 +            params = { area_id = area.id },
   1.124 +            content = function()
   1.125 +              ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "add" }
   1.126 +              ui.tag{ content = _"new issue" }
   1.127 +            end
   1.128 +          }
   1.129 +        end
   1.130 +      end }
   1.131 +    end
   1.132 +  end }
   1.133 +elseif unit then
   1.134 +  ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
   1.135 +    ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
   1.136 +      ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name }
   1.137 +    end }
   1.138 +    if unit.description and #(unit.description) > 0 then
   1.139 +      ui.container{ attr = { class = "mdl-card__supporting-text mdl-card--border" }, content = unit.description }
   1.140 +    end
   1.141 +    --ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
   1.142 +    --end }
   1.143 +  end }
   1.144 +end
   1.145 +  

Impressum / About Us