bsw@525: local area = param.get("area", "table") bsw@774: local member = param.get("member", "table") bsw@525: bsw@529: local show_content = param.get("show_content", atom.boolean) bsw@529: bsw@815: if app.session.member_id then bsw@815: area:load_delegation_info_once_for_member_id(app.session.member_id) bsw@815: end bsw@529: bsw@619: if not param.get("hide_unit", atom.boolean) then bsw@795: execute.view{ module = "unit", view = "_head", params = { unit = area.unit, member = member } } bsw@619: end bsw@525: bsw@526: ui.container{ attr = { class = "area_head" }, content = function() bsw@525: bsw@774: execute.view{ module = "delegation", view = "_info", params = { area = area, member = member } } 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@781: if member then bsw@525: bsw@529: -- membership bsw@774: local membership = Membership:by_pk(area.id, member.id) bsw@525: bsw@529: if membership then bsw@529: bsw@774: if app.session.member_id == member.id then bsw@774: ui.tag{ content = _"You are participating in this area" } bsw@782: slot.put(" ") bsw@774: ui.tag{ content = function() bsw@774: slot.put("(") bsw@774: ui.link{ bsw@774: text = _"Withdraw", bsw@774: module = "membership", bsw@774: action = "update", bsw@774: params = { area_id = area.id, delete = true }, bsw@774: routing = { bsw@774: default = { bsw@774: mode = "redirect", bsw@774: module = request.get_module(), bsw@774: view = request.get_view(), bsw@774: id = param.get_id_cgi(), bsw@774: params = param.get_all_cgi() bsw@774: } bsw@529: } bsw@529: } bsw@774: slot.put(")") bsw@774: end } bsw@774: else bsw@774: ui.tag{ content = _"Member is participating in this area" } bsw@774: end bsw@529: bsw@774: elseif app.session.member_id == member.id and 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@774: if app.session.member_id == member.id and 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 }