annotate app/main/lf2/_areas.lua @ 217:73dbc9e2bfd4
Cummulative patch for enhancements at next generation frontend
author |
bsw |
date |
Sat Mar 12 19:22:50 2011 +0100 (2011-03-12) |
parents |
1dab81353eb1 |
children |
|
rev |
line source |
bsw@211
|
1 local areas = param.get("areas_selector", "table"):exec()
|
bsw@212
|
2 local current_area_id = param.get("current_area_id", atom.integer)
|
bsw@211
|
3 local head_content = param.get("head_content", "function")
|
bsw@215
|
4 local current_phase = param.get("current_phase")
|
bsw@211
|
5
|
bsw@212
|
6 if #areas == 0 then
|
bsw@212
|
7 return
|
bsw@212
|
8 end
|
bsw@212
|
9
|
bsw@212
|
10 areas:load("membership_for_member", { member_id = app.session.member_id}, "membership")
|
bsw@212
|
11
|
bsw@215
|
12 for i, area in ipairs(areas) do
|
bsw@215
|
13 local delegation = Delegation:by_pk(app.session.member_id, area.id)
|
bsw@215
|
14
|
bsw@215
|
15 local class = "area"
|
bsw@215
|
16 if (current_area_id and area.id == current_area_id)
|
bsw@215
|
17 or (not current_area_id and area.membership)
|
bsw@215
|
18 then
|
bsw@215
|
19 class = class .. " active"
|
bsw@211
|
20 end
|
bsw@215
|
21 ui.box_row{
|
bsw@215
|
22 class = class,
|
bsw@215
|
23 content = function()
|
bsw@215
|
24 ui.box_col{ class = "name", content = function()
|
bsw@215
|
25 if delegation then
|
bsw@215
|
26 execute.view{ module = "lf2", view = "_avatars", params = {
|
bsw@215
|
27 members = { delegation.trustee }, size = "small"
|
bsw@215
|
28 } }
|
bsw@215
|
29 end
|
bsw@215
|
30 ui.link{
|
bsw@215
|
31 module = "lf2", view = "area", id = area.id, params = {
|
bsw@215
|
32 phase = current_phase, order = current_order
|
bsw@215
|
33 },
|
bsw@215
|
34 text = area.name
|
bsw@215
|
35 }
|
bsw@215
|
36 end }
|
bsw@212
|
37 end
|
bsw@215
|
38 }
|
bsw@215
|
39
|
bsw@215
|
40 end
|