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@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@526: ui.container{ attr = { class = "content" }, content = function() bsw@525: bsw@526: -- actions (members with appropriate voting right only) bsw@526: if app.session.member_id then bsw@525: bsw@526: -- membership bsw@526: local membership = Membership:by_pk(area.id, app.session.member.id) bsw@525: bsw@526: if membership then bsw@526: bsw@526: ui.tag{ content = _"You are member" } bsw@526: bsw@526: slot.put(" ") bsw@526: bsw@526: ui.tag{ content = function() bsw@526: slot.put("(") bsw@526: ui.link{ bsw@526: text = _"Withdraw", bsw@526: module = "membership", bsw@526: action = "update", bsw@526: params = { area_id = area.id, delete = true }, bsw@526: routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } bsw@526: } bsw@526: slot.put(")") bsw@526: end } bsw@526: bsw@526: slot.put(" · ") bsw@525: bsw@526: elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then bsw@526: ui.link{ bsw@526: text = _"Become a member", bsw@526: module = "membership", bsw@526: action = "update", bsw@526: params = { area_id = area.id }, bsw@526: routing = { bsw@526: default = { bsw@526: mode = "redirect", bsw@526: module = "area", bsw@526: view = "show", bsw@526: id = area.id bsw@525: } bsw@525: } bsw@526: } bsw@525: bsw@526: slot.put(" · ") bsw@525: bsw@525: end bsw@525: bsw@526: -- create new issue bsw@526: if app.session.member:has_voting_right_for_unit_id(area.unit_id) then bsw@526: ui.link{ bsw@526: content = function() bsw@526: slot.put(_"Create new issue") bsw@526: end, bsw@526: module = "initiative", bsw@526: view = "new", bsw@526: params = { area_id = area.id } bsw@526: } bsw@526: end bsw@526: bsw@526: end bsw@526: bsw@525: end } bsw@526: bsw@526: end }