liquid_feedback_frontend
view app/main/area/_head.lua @ 619:7dc5ab12bfe3
Optical enhancements :)
author | bsw |
---|---|
date | Mon Jun 25 14:40:34 2012 +0200 (2012-06-25) |
parents | 5ca9de94cb13 |
children | cc542ac26edc |
line source
1 local area = param.get("area", "table")
3 local show_content = param.get("show_content", atom.boolean)
5 area:load_delegation_info_once_for_member_id(app.session.member_id)
7 if not param.get("hide_unit", atom.boolean) then
8 execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
9 end
11 ui.container{ attr = { class = "area_head" }, content = function()
13 execute.view{ module = "delegation", view = "_info", params = { area = area } }
15 ui.container{ attr = { class = "title" }, content = function()
16 -- area name
17 ui.link{
18 module = "area", view = "show", id = area.id,
19 attr = { class = "area_name" }, content = area.name
20 }
21 end }
23 if show_content then
25 ui.container{ attr = { class = "content" }, content = function()
27 -- actions (members with appropriate voting right only)
28 if app.session.member_id then
30 -- membership
31 local membership = Membership:by_pk(area.id, app.session.member.id)
33 if membership then
35 ui.tag{ content = _"You are participating in this area" }
37 slot.put(" ")
39 ui.tag{ content = function()
40 slot.put("(")
41 ui.link{
42 text = _"Withdraw",
43 module = "membership",
44 action = "update",
45 params = { area_id = area.id, delete = true },
46 routing = {
47 default = {
48 mode = "redirect",
49 module = request.get_module(),
50 view = request.get_view(),
51 id = param.get_id_cgi(),
52 params = param.get_all_cgi()
53 }
54 }
55 }
56 slot.put(")")
57 end }
60 elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
61 ui.link{
62 text = _"Participate in this area",
63 module = "membership",
64 action = "update",
65 params = { area_id = area.id },
66 routing = {
67 default = {
68 mode = "redirect",
69 module = request.get_module(),
70 view = request.get_view(),
71 id = param.get_id_cgi(),
72 params = param.get_all_cgi()
73 }
74 }
75 }
77 end
79 slot.put(" · ")
80 if area.delegation_info.own_delegation_scope ~= "area" then
81 ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } }
82 else
83 ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } }
84 end
85 slot.put(" · ")
87 -- create new issue
88 if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
89 ui.link{
90 content = function()
91 slot.put(_"Create new issue")
92 end,
93 module = "initiative",
94 view = "new",
95 params = { area_id = area.id }
96 }
97 end
99 end
101 end }
103 else
104 slot.put("<br />")
105 end
107 end }