bsw@525: local area = param.get("area", "table") bsw@525: bsw@525: execute.view{ module = "unit", view = "_head", params = { unit = area.unit } } bsw@525: bsw@525: slot.select("head", function() bsw@525: bsw@525: ui.container{ attr = { class = "area_head" }, content = function() bsw@525: bsw@525: execute.view{ module = "delegation", view = "_info", params = { area = area } } bsw@525: bsw@525: ui.container{ attr = { class = "title" }, content = function() bsw@525: -- area name bsw@525: ui.link{ bsw@525: module = "area", view = "show", id = area.id, bsw@525: attr = { class = "area_name" }, content = area.name bsw@525: } bsw@525: end } bsw@525: bsw@525: ui.container{ attr = { class = "content" }, content = function() bsw@525: bsw@525: -- actions (members with appropriate voting right only) bsw@525: if app.session.member_id then bsw@525: bsw@525: -- membership bsw@525: local membership = Membership:by_pk(area.id, app.session.member.id) bsw@525: bsw@525: if membership then bsw@525: bsw@525: ui.tag{ content = _"You are member" } bsw@525: bsw@525: slot.put(" ") bsw@525: bsw@525: ui.tag{ content = function() bsw@525: slot.put("(") bsw@525: ui.link{ bsw@525: text = _"Withdraw", bsw@525: module = "membership", bsw@525: action = "update", bsw@525: params = { area_id = area.id, delete = true }, bsw@525: routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } bsw@525: } bsw@525: slot.put(")") bsw@525: end } bsw@525: bsw@525: slot.put(" · ") bsw@525: bsw@525: elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then bsw@525: ui.link{ bsw@525: text = _"Become a member", bsw@525: module = "membership", bsw@525: action = "update", bsw@525: params = { area_id = area.id }, bsw@525: routing = { bsw@525: default = { bsw@525: mode = "redirect", bsw@525: module = "area", bsw@525: view = "show", bsw@525: id = area.id bsw@525: } bsw@525: } bsw@525: } bsw@525: bsw@525: slot.put(" · ") bsw@525: bsw@525: end bsw@525: bsw@525: -- create new issue bsw@525: if app.session.member:has_voting_right_for_unit_id(area.unit_id) then bsw@525: ui.link{ bsw@525: content = function() bsw@525: slot.put(_"Create new issue") bsw@525: end, bsw@525: module = "initiative", bsw@525: view = "new", bsw@525: params = { area_id = area.id } bsw@525: } bsw@525: end bsw@525: bsw@525: end bsw@525: bsw@525: end } bsw@525: bsw@525: end } bsw@525: bsw@525: end)