annotate app/main/lf2/_sidebar_unit.lua @ 212:3e4ad069847a
Some more work at 2nd generation frontend code
author |
bsw |
date |
Thu Mar 03 18:39:00 2011 +0100 (2011-03-03) |
parents |
|
children |
1dab81353eb1 |
rev |
line source |
bsw@212
|
1 local unit = param.get("unit", "table")
|
bsw@212
|
2
|
bsw@212
|
3 local trustees = Member:new_selector()
|
bsw@212
|
4 :add_field("delegation_chain.*")
|
bsw@212
|
5 :join("delegation_chain(" .. tostring(app.session.member.id) .. ", NULL, NULL)", "delegation_chain", "member.id = delegation_chain.member_id")
|
bsw@212
|
6 :add_order_by("index")
|
bsw@212
|
7 :exec()
|
bsw@212
|
8
|
bsw@212
|
9 ui.box{ content = function()
|
bsw@212
|
10 ui.box_row{ class = "head", content = function()
|
bsw@212
|
11 ui.box_col{ class = "head", content = _"DE / Berlin / Friedrichshain-Kreuzberg" }
|
bsw@212
|
12 end }
|
bsw@212
|
13
|
bsw@212
|
14 if #trustees > 1 then
|
bsw@212
|
15 ui.box_row{ content = function() ui.box_col{ content = function()
|
bsw@212
|
16 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
|
bsw@212
|
17 end } end }
|
bsw@212
|
18 end
|
bsw@212
|
19
|
bsw@212
|
20 ui.box_row{ content = function() ui.box_col{ content = function()
|
bsw@212
|
21 if trustees[1].scope_out == "global" then
|
bsw@212
|
22 text = _"Change or revoke unit delegation..."
|
bsw@212
|
23 else
|
bsw@212
|
24 text = _"Set unit delegation..."
|
bsw@212
|
25 end
|
bsw@212
|
26 ui.link{
|
bsw@212
|
27 text = text,
|
bsw@212
|
28 module = "lf2", view = "delegation", params = { unit_id = unit.id }
|
bsw@212
|
29 }
|
bsw@212
|
30 end } end }
|
bsw@212
|
31
|
bsw@212
|
32 end }
|
bsw@212
|
33 |