liquid_feedback_frontend
changeset 1596:9f55297a1a6a
Reworked subject area delegation buttons
author | bsw |
---|---|
date | Sun Jan 31 20:35:05 2021 +0100 (2021-01-31) |
parents | ec0d69b4bb20 |
children | 631f6311a9eb |
files | app/main/_layout/default.html app/main/index/_head.lua |
line diff
1.1 --- a/app/main/_layout/default.html Sun Jan 31 20:34:37 2021 +0100 1.2 +++ b/app/main/_layout/default.html Sun Jan 31 20:35:05 2021 +0100 1.3 @@ -217,37 +217,18 @@ 1.4 height: auto; 1.5 min-height: 52px; 1.6 } 1.7 + .mdl-chip { 1.8 + vertical-align: middle; 1.9 + } 1.10 .mdl-chip.clickable { 1.11 cursor: pointer; 1.12 } 1.13 - .mdl-chip.unit, 1.14 - .mdl-chip.area, 1.15 - .mdl-chip.issue { 1.16 - padding: 1px 6px; 1.17 - line-height: 24px; 1.18 - height: 24px; 1.19 - vertical-align: bottom; 1.20 - margin-right: 4px; 1.21 - margin-bottom: 8px; 1.22 - } 1.23 - .mdl-chip.unit i, 1.24 - .mdl-chip.area i, 1.25 - .mdl-chip.issue i { 1.26 - font-size: 18px; 1.27 - color: #444; 1.28 - } 1.29 - .mdl-chip.unit { 1.30 - xbackground: rgba(76,175,80,0.2); 1.31 - } 1.32 - .mdl-chip.area { 1.33 - xbackground: rgba(76,175,80,0.2); 1.34 - } 1.35 - .mdl-chip.issue { 1.36 - xbackground: rgba(76,175,80,0.2); 1.37 - } 1.38 .mdl-menu { 1.39 z-index: -9999; 1.40 } 1.41 + .mdl-card { 1.42 + z-index: auto !important; 1.43 + } 1.44 .mdl-menu__item { 1.45 padding: 0; 1.46 }
2.1 --- a/app/main/index/_head.lua Sun Jan 31 20:34:37 2021 +0100 2.2 +++ b/app/main/index/_head.lua Sun Jan 31 20:35:05 2021 +0100 2.3 @@ -14,10 +14,7 @@ 2.4 if area_id then 2.5 area = Area:by_id(area_id) 2.6 end 2.7 -if area and unit and area.unit_id ~= unit.id then 2.8 - area_id = nil 2.9 -end 2.10 -if area and area.unit_id == unit_id then 2.11 +if area then 2.12 if app.session.member_id then 2.13 area:load_delegation_info_once_for_member_id(app.session.member_id) 2.14 end 2.15 @@ -26,7 +23,7 @@ 2.16 if unit then 2.17 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 2.18 if not config.single_area_id then 2.19 - ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name .. " / " .. area.name } 2.20 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name .. " ยป " .. area.name } 2.21 else 2.22 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name } 2.23 end 2.24 @@ -42,77 +39,55 @@ 2.25 if not (config.voting_only and config.disable_delegations) and app.session.member_id then 2.26 ui.container{ attr = { class = "mdl-card__actions" }, content = function() 2.27 2.28 - if app.session.member_id then 2.29 + if not config.disable_delegations then 2.30 + 2.31 if area.delegation_info.first_trustee_id then 2.32 - local member = Member:by_id(area.delegation_info.first_trustee_id) 2.33 - ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" } 2.34 - execute.view{ 2.35 - module = "member_image", 2.36 - view = "_show", 2.37 - params = { 2.38 - member = member, 2.39 - image_type = "avatar", 2.40 - show_dummy = true 2.41 - } 2.42 + local member = Member:by_id(area.delegation_info.first_trustee_id) 2.43 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" } 2.44 + execute.view{ 2.45 + module = "member", 2.46 + view = "_show_thumb", 2.47 + params = { 2.48 + member = member 2.49 } 2.50 + } 2.51 end 2.52 + 2.53 + local text 2.54 + if area.delegation_info.own_delegation_scope == nil then 2.55 + text = _"delegate..." 2.56 + else 2.57 + text = _"change delegation..." 2.58 + end 2.59 + 2.60 + 2.61 + ui.tag{ attr = { id = "change_delegation", class = "mdl-button" }, content = text } 2.62 2.63 - if not config.disable_delegations then 2.64 - if area.delegation_info.own_delegation_scope == "unit" then 2.65 + 2.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() 2.67 + 2.68 + ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function() 2.69 ui.link { 2.70 - attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, 2.71 + attr = { class = "mdl-menu__link" }, 2.72 module = "delegation", view = "show", params = { 2.73 unit_id = area.unit_id, 2.74 }, 2.75 - content = _("change/revoke delegation of organizational unit") 2.76 + content = _("unit: #{name}", { name = area.unit.name }) 2.77 } 2.78 - slot.put(" ") 2.79 - end 2.80 - if area.delegation_info.own_delegation_scope == nil then 2.81 - local text 2.82 - if config.single_area_id then 2.83 - text = _"choose delegatee" 2.84 - else 2.85 - text = _"choose subject area delegatee" 2.86 - end 2.87 + end } 2.88 + 2.89 + ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function() 2.90 ui.link { 2.91 - attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, 2.92 + attr = { class = "mdl-menu__link" }, 2.93 module = "delegation", view = "show", params = { 2.94 area_id = area.id 2.95 }, 2.96 - content = function() 2.97 - ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" } 2.98 - ui.tag{ content = text } 2.99 - end 2.100 + content = _("subject area: #{name}", { name = area.name }) 2.101 } 2.102 - slot.put(" ") 2.103 - elseif area.delegation_info.own_delegation_scope == "area" then 2.104 - local text 2.105 - if config.single_area_id then 2.106 - text = _"change/revoke delegation" 2.107 - else 2.108 - text = _"change/revoke area delegation" 2.109 - end 2.110 - ui.link { 2.111 - attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, 2.112 - module = "delegation", view = "show", params = { 2.113 - area_id = area.id 2.114 - }, 2.115 - content = text 2.116 - } 2.117 - slot.put(" ") 2.118 - else 2.119 - ui.link { 2.120 - attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, 2.121 - module = "delegation", view = "show", params = { 2.122 - area_id = area.id 2.123 - }, 2.124 - content = _"change/revoke delegation only for this subject area" 2.125 - } 2.126 - slot.put(" ") 2.127 - end 2.128 - end 2.129 + end } 2.130 + end } 2.131 end 2.132 + 2.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 2.134 ui.link { 2.135 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },