liquid_feedback_frontend

view app/main/area/_head.lua @ 774:a3eb6ca34484

Completed membership/privilege tab in member page
author bsw
date Thu Jun 28 23:57:02 2012 +0200 (2012-06-28)
parents cc542ac26edc
children e07c9ce87470
line source
1 local area = param.get("area", "table")
2 local member = param.get("member", "table")
4 local show_content = param.get("show_content", atom.boolean)
6 area:load_delegation_info_once_for_member_id(app.session.member_id)
8 if not param.get("hide_unit", atom.boolean) then
9 execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
10 end
12 ui.container{ attr = { class = "area_head" }, content = function()
14 execute.view{ module = "delegation", view = "_info", params = { area = area, member = member } }
16 ui.container{ attr = { class = "title" }, content = function()
17 -- area name
18 ui.link{
19 module = "area", view = "show", id = area.id,
20 attr = { class = "area_name" }, content = area.name
21 }
22 end }
24 if show_content then
26 ui.container{ attr = { class = "content" }, content = function()
28 -- actions (members with appropriate voting right only)
29 if app.session.member_id then
31 -- membership
32 local membership = Membership:by_pk(area.id, member.id)
34 if membership then
36 if app.session.member_id == member.id then
37 ui.tag{ content = _"You are participating in this area" }
38 ui.tag{ content = function()
39 slot.put("(")
40 ui.link{
41 text = _"Withdraw",
42 module = "membership",
43 action = "update",
44 params = { area_id = area.id, delete = true },
45 routing = {
46 default = {
47 mode = "redirect",
48 module = request.get_module(),
49 view = request.get_view(),
50 id = param.get_id_cgi(),
51 params = param.get_all_cgi()
52 }
53 }
54 }
55 slot.put(")")
56 end }
57 else
58 ui.tag{ content = _"Member is participating in this area" }
59 end
60 slot.put(" ")
62 elseif app.session.member_id == member.id and member:has_voting_right_for_unit_id(area.unit_id) then
63 ui.link{
64 text = _"Participate in this area",
65 module = "membership",
66 action = "update",
67 params = { area_id = area.id },
68 routing = {
69 default = {
70 mode = "redirect",
71 module = request.get_module(),
72 view = request.get_view(),
73 id = param.get_id_cgi(),
74 params = param.get_all_cgi()
75 }
76 }
77 }
78 end
80 if app.session.member_id == member.id and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
82 slot.put(" · ")
83 if area.delegation_info.own_delegation_scope ~= "area" then
84 ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } }
85 else
86 ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } }
87 end
88 slot.put(" · ")
90 ui.link{
91 content = function()
92 slot.put(_"Create new issue")
93 end,
94 module = "initiative",
95 view = "new",
96 params = { area_id = area.id }
97 }
98 end
100 end
102 end }
104 else
105 slot.put("<br />")
106 end
108 end }

Impressum / About Us