liquid_feedback_frontend
diff app/main/area/_head.lua @ 525:63d6549cc00b
Delegation chain preview improved, better visualisation of current context, code cleanup
author | bsw |
---|---|
date | Fri May 18 19:07:07 2012 +0200 (2012-05-18) |
parents | |
children | 18cd8595459b |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/area/_head.lua Fri May 18 19:07:07 2012 +0200 1.3 @@ -0,0 +1,85 @@ 1.4 +local area = param.get("area", "table") 1.5 + 1.6 +execute.view{ module = "unit", view = "_head", params = { unit = area.unit } } 1.7 + 1.8 +slot.select("head", function() 1.9 + 1.10 + ui.container{ attr = { class = "area_head" }, content = function() 1.11 + 1.12 + execute.view{ module = "delegation", view = "_info", params = { area = area } } 1.13 + 1.14 + ui.container{ attr = { class = "title" }, content = function() 1.15 + -- area name 1.16 + ui.link{ 1.17 + module = "area", view = "show", id = area.id, 1.18 + attr = { class = "area_name" }, content = area.name 1.19 + } 1.20 + end } 1.21 + 1.22 + ui.container{ attr = { class = "content" }, content = function() 1.23 + 1.24 + -- actions (members with appropriate voting right only) 1.25 + if app.session.member_id then 1.26 + 1.27 + -- membership 1.28 + local membership = Membership:by_pk(area.id, app.session.member.id) 1.29 + 1.30 + if membership then 1.31 + 1.32 + ui.tag{ content = _"You are member" } 1.33 + 1.34 + slot.put(" ") 1.35 + 1.36 + ui.tag{ content = function() 1.37 + slot.put("(") 1.38 + ui.link{ 1.39 + text = _"Withdraw", 1.40 + module = "membership", 1.41 + action = "update", 1.42 + params = { area_id = area.id, delete = true }, 1.43 + routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } 1.44 + } 1.45 + slot.put(")") 1.46 + end } 1.47 + 1.48 + slot.put(" · ") 1.49 + 1.50 + elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.51 + ui.link{ 1.52 + text = _"Become a member", 1.53 + module = "membership", 1.54 + action = "update", 1.55 + params = { area_id = area.id }, 1.56 + routing = { 1.57 + default = { 1.58 + mode = "redirect", 1.59 + module = "area", 1.60 + view = "show", 1.61 + id = area.id 1.62 + } 1.63 + } 1.64 + } 1.65 + 1.66 + slot.put(" · ") 1.67 + 1.68 + end 1.69 + 1.70 + -- create new issue 1.71 + if app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.72 + ui.link{ 1.73 + content = function() 1.74 + slot.put(_"Create new issue") 1.75 + end, 1.76 + module = "initiative", 1.77 + view = "new", 1.78 + params = { area_id = area.id } 1.79 + } 1.80 + end 1.81 + 1.82 + end 1.83 + 1.84 + end } 1.85 + 1.86 + end } 1.87 + 1.88 +end) 1.89 \ No newline at end of file