liquid_feedback_frontend

annotate app/main/index/_head.lua @ 1496:ed3c40911ae1

Completed image attachments feature
author bsw
date Tue Feb 11 15:24:36 2020 +0100 (2020-02-11)
parents 3ab878ba277e
children 3c15fea3f1c0
rev   line source
bsw/jbe@1309 1 local unit_id = config.single_unit_id or tonumber(request.get_param{ name = "unit" })
bsw/jbe@1309 2 if unit_id == "all" then
bsw/jbe@1309 3 unit_id = nil
bsw/jbe@1309 4 end
bsw/jbe@1309 5 local unit
bsw/jbe@1309 6 if unit_id then
bsw/jbe@1309 7 unit = Unit:by_id(unit_id)
bsw/jbe@1309 8 end
bsw/jbe@1309 9 local area_id = config.single_area_id or tonumber(request.get_param{ name = "area" })
bsw/jbe@1309 10 if area_id == "all" then
bsw/jbe@1309 11 area_id = nil
bsw/jbe@1309 12 end
bsw/jbe@1309 13 local area
bsw/jbe@1309 14 if area_id then
bsw/jbe@1309 15 area = Area:by_id(area_id)
bsw/jbe@1309 16 end
bsw/jbe@1309 17 if area and unit and area.unit_id ~= unit.id then
bsw/jbe@1309 18 area_id = nil
bsw/jbe@1309 19 end
bsw/jbe@1309 20 if area and area.unit_id == unit_id then
bsw/jbe@1309 21 if app.session.member_id then
bsw/jbe@1309 22 area:load_delegation_info_once_for_member_id(app.session.member_id)
bsw/jbe@1309 23 end
bsw/jbe@1309 24
bsw/jbe@1309 25 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw/jbe@1309 26 if unit then
bsw/jbe@1309 27 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw/jbe@1309 28 if not config.single_area_id then
bsw/jbe@1309 29 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name .. " / " .. area.name }
bsw/jbe@1309 30 else
bsw/jbe@1309 31 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name }
bsw/jbe@1309 32 end
bsw/jbe@1309 33 end }
bsw/jbe@1309 34 end
bsw/jbe@1309 35 if area.description and #(area.description) > 0 then
bsw/jbe@1309 36 if not config.single_area_id then
bsw/jbe@1309 37 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = area.description }
bsw/jbe@1309 38 else
bsw/jbe@1309 39 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = unit.description }
bsw/jbe@1309 40 end
bsw/jbe@1309 41 end
bsw/jbe@1309 42 if not (config.voting_only and config.disable_delegations) and app.session.member_id then
bsw/jbe@1309 43 ui.container{ attr = { class = "mdl-card__actions" }, content = function()
bsw/jbe@1309 44
bsw/jbe@1309 45 if app.session.member_id then
bsw/jbe@1309 46 if area.delegation_info.first_trustee_id then
bsw/jbe@1309 47 local member = Member:by_id(area.delegation_info.first_trustee_id)
bsw/jbe@1309 48 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
bsw/jbe@1309 49 execute.view{
bsw/jbe@1309 50 module = "member_image",
bsw/jbe@1309 51 view = "_show",
bsw/jbe@1309 52 params = {
bsw/jbe@1309 53 member = member,
bsw/jbe@1309 54 image_type = "avatar",
bsw/jbe@1309 55 show_dummy = true
bsw/jbe@1309 56 }
bsw/jbe@1309 57 }
bsw/jbe@1309 58 end
bsw/jbe@1309 59
bsw/jbe@1309 60 if not config.disable_delegations then
bsw/jbe@1309 61 if area.delegation_info.own_delegation_scope == "unit" then
bsw/jbe@1309 62 ui.link {
bsw/jbe@1309 63 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
bsw/jbe@1309 64 module = "delegation", view = "show", params = {
bsw/jbe@1309 65 unit_id = area.unit_id,
bsw/jbe@1309 66 },
bsw/jbe@1309 67 content = _("change/revoke delegation of organizational unit")
bsw/jbe@1309 68 }
bsw/jbe@1309 69 slot.put("   ")
bsw/jbe@1309 70 end
bsw/jbe@1309 71 if area.delegation_info.own_delegation_scope == nil then
bsw/jbe@1309 72 local text
bsw/jbe@1309 73 if config.single_area_id then
bsw/jbe@1309 74 text = _"choose delegatee"
bsw/jbe@1309 75 else
bsw/jbe@1309 76 text = _"choose subject area delegatee"
bsw/jbe@1309 77 end
bsw/jbe@1309 78 ui.link {
bsw/jbe@1309 79 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
bsw/jbe@1309 80 module = "delegation", view = "show", params = {
bsw/jbe@1309 81 area_id = area.id
bsw/jbe@1309 82 },
bsw/jbe@1309 83 content = function()
bsw/jbe@1309 84 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
bsw/jbe@1309 85 ui.tag{ content = text }
bsw/jbe@1309 86 end
bsw/jbe@1309 87 }
bsw/jbe@1309 88 slot.put("   ")
bsw/jbe@1309 89 elseif area.delegation_info.own_delegation_scope == "area" then
bsw/jbe@1309 90 local text
bsw/jbe@1309 91 if config.single_area_id then
bsw/jbe@1309 92 text = _"change/revoke delegation"
bsw/jbe@1309 93 else
bsw/jbe@1309 94 text = _"change/revoke area delegation"
bsw/jbe@1309 95 end
bsw/jbe@1309 96 ui.link {
bsw/jbe@1309 97 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
bsw/jbe@1309 98 module = "delegation", view = "show", params = {
bsw/jbe@1309 99 area_id = area.id
bsw/jbe@1309 100 },
bsw/jbe@1309 101 content = text
bsw/jbe@1309 102 }
bsw/jbe@1309 103 slot.put("   ")
bsw/jbe@1309 104 else
bsw/jbe@1309 105 ui.link {
bsw/jbe@1309 106 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
bsw/jbe@1309 107 module = "delegation", view = "show", params = {
bsw/jbe@1309 108 area_id = area.id
bsw/jbe@1309 109 },
bsw/jbe@1309 110 content = _"change/revoke delegation only for this subject area"
bsw/jbe@1309 111 }
bsw/jbe@1309 112 slot.put("   ")
bsw/jbe@1309 113 end
bsw/jbe@1309 114 end
bsw/jbe@1309 115 end
bsw/jbe@1309 116 if not config.voting_only and app.session.member_id and app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then
bsw/jbe@1309 117 ui.link {
bsw/jbe@1309 118 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
bsw@1496 119 module = "draft", view = "new",
bsw/jbe@1309 120 params = { area_id = area.id },
bsw/jbe@1309 121 content = function()
bsw/jbe@1309 122 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "add" }
bsw/jbe@1309 123 ui.tag{ content = _"new issue" }
bsw/jbe@1309 124 end
bsw/jbe@1309 125 }
bsw/jbe@1309 126 end
bsw/jbe@1309 127 end }
bsw/jbe@1309 128 end
bsw/jbe@1309 129 end }
bsw/jbe@1309 130 elseif unit then
bsw/jbe@1309 131 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw/jbe@1309 132 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw/jbe@1309 133 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name }
bsw/jbe@1309 134 end }
bsw/jbe@1309 135 if unit.description and #(unit.description) > 0 then
bsw/jbe@1309 136 ui.container{ attr = { class = "mdl-card__supporting-text mdl-card--border" }, content = unit.description }
bsw/jbe@1309 137 end
bsw/jbe@1309 138 --ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
bsw/jbe@1309 139 --end }
bsw/jbe@1309 140 end }
bsw@1489 141 else
bsw@1489 142 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw@1489 143 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw@1489 144 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"All issues" }
bsw@1489 145 end }
bsw@1489 146 ui.container{ attr = { class = "mdl-card__supporting-text mdl-card--border" }, content = _"All issues in your units. Use filters above to limit results." }
bsw@1489 147 end }
bsw/jbe@1309 148 end
bsw/jbe@1309 149

Impressum / About Us