liquid_feedback_frontend

view app/main/lf2/_area.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 4993b71b383f
children 1dab81353eb1
line source
1 local area = param.get("area", "table")
3 local membership = Membership:by_pk(area.id, app.session.member_id)
5 local trustees = Member:new_selector()
6 :add_field("delegation_chain.*")
7 :join("delegation_chain(" .. app.session.member_id .. ", " .. area.id .. ", NULL)", "delegation_chain", "member.id = delegation_chain.member_id")
8 :add_order_by("index")
9 :exec()
11 ui.box{ class = "area", content = function()
13 ui.box_row{ class = "head", content = function()
14 ui.box_col{ class = "head left name", content = area.name }
15 ui.box_col{ class = "right", content = _("#{direct_count}+#{delegated_count} members", {
16 direct_count = area.direct_member_count,
17 delegated_count = area.member_weight - area.direct_member_count
18 } ) }
19 end }
21 if area.description and #area.description > 0 then
22 ui.box_row{ class = "description", content = function() ui.box_col{ content = area.description } end }
23 end
25 if #trustees > 1 then
26 ui.box_row{ content = function()
27 ui.box_col{ class = "left", content = function()
28 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
29 end }
30 if trustees[1].scope_out == "area" then
31 text = _"Change or revoke area delegation..."
32 else
33 text = _"Set area delegation..."
34 end
35 ui.box_col{ class = "right", content = function()
36 ui.link{
37 text = text,
38 module = "lf2", view = "delegation", params = { area_id = area.id }
39 }
40 end }
41 end }
42 end
44 ui.box_row{ content = function()
45 ui.box_col{ class = "left", content = function()
46 if membership then
47 ui.image{ static = "lf2/icon_star.png" }
48 slot.put(" ", _"You are member of this area")
49 else
50 ui.link{
51 module = "membership", action = "update", params = { area_id = area.id },
52 routing = { default = {
53 mode = "redirect", module = "lf2", view = "area", id = area.id
54 } },
55 text = _"Become a member of this area"
56 }
57 end
58 end }
59 ui.box_col{ class = "right", content = function()
60 if membership then
61 ui.link{
62 module = "membership", action = "update", params = { area_id = area.id, delete = true },
63 routing = { default = {
64 mode = "redirect", module = "lf2", view = "area", id = area.id
65 } },
66 text = _"Give up membership"
67 }
68 end
69 if #trustees == 1 then
70 if membership then
71 slot.put(" · ")
72 end
73 ui.link{
74 text = _"Set area delegation...",
75 module = "lf2", view = "delegation", params = { area_id = area.id }
76 }
77 end
78 end }
79 end }
81 end }

Impressum / About Us