bsw@525: local area = param.get("area", "table") bsw@525: bsw@529: local show_content = param.get("show_content", atom.boolean) bsw@529: bsw@529: area:load_delegation_info_once_for_member_id(app.session.member_id) bsw@529: bsw@619: if not param.get("hide_unit", atom.boolean) then bsw@619: execute.view{ module = "unit", view = "_head", params = { unit = area.unit } } bsw@619: end bsw@525: bsw@526: ui.container{ attr = { class = "area_head" }, content = function() bsw@525: bsw@526: execute.view{ module = "delegation", view = "_info", params = { area = area } } bsw@525: bsw@526: ui.container{ attr = { class = "title" }, content = function() bsw@526: -- area name bsw@526: ui.link{ bsw@526: module = "area", view = "show", id = area.id, bsw@526: attr = { class = "area_name" }, content = area.name bsw@526: } bsw@526: end } bsw@526: bsw@529: if show_content then bsw@529: bsw@529: ui.container{ attr = { class = "content" }, content = function() bsw@525: bsw@529: -- actions (members with appropriate voting right only) bsw@529: if app.session.member_id then bsw@525: bsw@529: -- membership bsw@529: local membership = Membership:by_pk(area.id, app.session.member.id) bsw@525: bsw@529: if membership then bsw@529: bsw@529: ui.tag{ content = _"You are participating in this area" } bsw@529: bsw@529: slot.put(" ") bsw@529: bsw@529: ui.tag{ content = function() bsw@529: slot.put("(") bsw@529: ui.link{ bsw@529: text = _"Withdraw", bsw@529: module = "membership", bsw@529: action = "update", bsw@529: params = { area_id = area.id, delete = true }, bsw@529: routing = { bsw@529: default = { bsw@529: mode = "redirect", bsw@529: module = request.get_module(), bsw@529: view = request.get_view(), bsw@529: id = param.get_id_cgi(), bsw@529: params = param.get_all_cgi() bsw@529: } bsw@529: } bsw@529: } bsw@529: slot.put(")") bsw@529: end } bsw@529: bsw@529: bsw@529: elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then bsw@526: ui.link{ bsw@529: text = _"Participate in this area", bsw@529: module = "membership", bsw@529: action = "update", bsw@529: params = { area_id = area.id }, bsw@528: routing = { bsw@528: default = { bsw@528: mode = "redirect", bsw@528: module = request.get_module(), bsw@528: view = request.get_view(), bsw@528: id = param.get_id_cgi(), bsw@528: params = param.get_all_cgi() bsw@528: } bsw@528: } bsw@526: } bsw@529: end bsw@622: bsw@622: if app.session.member:has_voting_right_for_unit_id(area.unit_id) then bsw@529: bsw@622: slot.put(" · ") bsw@622: if area.delegation_info.own_delegation_scope ~= "area" then bsw@622: ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } } bsw@622: else bsw@622: ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } } bsw@622: end bsw@622: slot.put(" · ") bsw@525: bsw@529: ui.link{ bsw@529: content = function() bsw@529: slot.put(_"Create new issue") bsw@529: end, bsw@529: module = "initiative", bsw@529: view = "new", bsw@529: params = { area_id = area.id } bsw@525: } bsw@529: end bsw@525: bsw@525: end bsw@525: bsw@529: end } bsw@526: bsw@529: else bsw@529: slot.put("
") bsw@529: end bsw@526: bsw@526: end }