liquid_feedback_frontend
view app/main/lf2/_sidebar_unit.lua @ 215:1dab81353eb1
More enhancements for second generation frontend
author | bsw |
---|---|
date | Sat Mar 05 15:34:17 2011 +0100 (2011-03-05) |
parents | 3e4ad069847a |
children | 73dbc9e2bfd4 |
line source
1 local current_area_id = param.get("current_area_id", atom.integer)
2 local current_phase = param.get_all_cgi()["phase"]
4 local member_areas_selector = Area:build_selector{
5 member_id = app.session.member_id,
6 order = "name"
7 }
8 local other_areas_selector = Area:build_selector{
9 not_member_id = app.session.member_id,
10 order = "name"
11 }
13 local unit = {}
15 local trustees = Member:new_selector()
16 :add_field("delegation_chain.*")
17 :join("delegation_chain(" .. tostring(app.session.member.id) .. ", NULL, NULL)", "delegation_chain", "member.id = delegation_chain.member_id")
18 :add_order_by("index")
19 :exec()
21 local row_count = member_areas_selector:count() + other_areas_selector:count() + 4
22 if #trustees > 1 then
23 row_count = row_count + 1
24 end
26 ui.box{ row_count = row_count, content = function()
27 ui.box_row{ class = "head", content = function()
28 ui.box_col{ class = "head", content = _"DE / Berlin / Friedrichshain-Kreuzberg" }
29 end }
31 if #trustees > 1 then
32 ui.box_row{ content = function() ui.box_col{ content = function()
33 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
34 end } end }
35 end
37 ui.box_row{ content = function() ui.box_col{ content = function()
38 if trustees[1].scope_out == "global" then
39 text = _"Change or revoke unit delegation"
40 else
41 text = _"Set unit delegation"
42 end
43 ui.link{
44 text = text,
45 module = "lf2", view = "delegation", params = { unit_id = unit.id }
46 }
47 end } end }
50 ui.form{
51 method = "get",
52 content = function()
54 ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = function()
55 ui.link{ text = _"Areas, you are member of", module = "lf2", view = "index" }
56 end } end }
58 execute.view{
59 module = "lf2", view = "_areas", params = {
60 areas_selector = member_areas_selector,
61 current_area_id = current_area_id,
62 current_phase = current_phase
63 }
64 }
66 ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = function()
67 ui.link{ content = _"Other areas", module = "lf2", view = "index" }
68 end } end }
70 execute.view{
71 module = "lf2", view = "_areas", params = {
72 areas_selector = other_areas_selector,
73 current_area_id = current_area_id,
74 current_phase = current_phase
75 }
76 }
78 end
79 }
81 end }
83 execute.view{ module = "lf2", view = "_search", params = { area = area } }