liquid_feedback_frontend

annotate app/main/lf2/_area.lua @ 211:4993b71b383f

First checkin of lf2 (frontend second generation) prototype
author bsw
date Wed Mar 02 20:06:26 2011 +0100 (2011-03-02)
parents
children 3e4ad069847a
rev   line source
bsw@211 1 local area = param.get("area", "table")
bsw@211 2
bsw@211 3 local membership = Membership:by_pk(area.id, app.session.member_id)
bsw@211 4
bsw@211 5 local trustees = Member:new_selector()
bsw@211 6 :add_field("delegation_chain.*")
bsw@211 7 :join("delegation_chain(" .. app.session.member_id .. ", " .. area.id .. ", NULL)", "delegation_chain", "member.id = delegation_chain.member_id")
bsw@211 8 :add_order_by("index")
bsw@211 9 :exec()
bsw@211 10
bsw@211 11 ui.box{ class = "area", content = function()
bsw@211 12
bsw@211 13 ui.box_row{ class = "head", content = function()
bsw@211 14 ui.box_col{ class = "left name", content = area.name }
bsw@211 15 ui.box_col{ class = "right", content = _("#{direct_count}+#{delegated_count} Mitglieder", {
bsw@211 16 direct_count = area.direct_member_count,
bsw@211 17 delegated_count = area.member_weight - area.direct_member_count
bsw@211 18 } ) }
bsw@211 19 end }
bsw@211 20
bsw@211 21 if area.description and #area.description > 0 then
bsw@211 22 ui.box_row{ class = "description", content = function() ui.box_col{ content = area.description } end }
bsw@211 23 end
bsw@211 24
bsw@211 25 ui.box_row{ class = "member_count", content = function()
bsw@211 26 end }
bsw@211 27
bsw@211 28 ui.box_row{ content = function()
bsw@211 29 ui.box_col{ class = "left", content = function()
bsw@211 30 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
bsw@211 31 end }
bsw@211 32 ui.box_col{ class = "right", content = function()
bsw@211 33 ui.tag{ content = _"[Change] or [revoke] area delegation [prefix]" }
bsw@211 34 ui.link{ text = _"[Change] or [revoke] area delegation [change]" }
bsw@211 35 ui.tag{ content = _"[Change] or [revoke] area delegation [midpart]" }
bsw@211 36 ui.link{ text = _"[Change] or [revoke] area delegation [revoke]" }
bsw@211 37 ui.tag{ content = _"[Change] or [revoke] area delegation [suffix]" }
bsw@211 38 end }
bsw@211 39 end }
bsw@211 40
bsw@211 41 ui.box_row{ content = function()
bsw@211 42 ui.box_col{ class = "left", content = function()
bsw@211 43 if membership then
bsw@211 44 ui.image{ static = "lf2/icon_star.png" }
bsw@211 45 slot.put(" ", _"You are member of this area")
bsw@211 46 else
bsw@211 47 ui.link{
bsw@211 48 module = "membership", action = "update", params = { area_id = area.id },
bsw@211 49 routing = { default = {
bsw@211 50 mode = "redirect", module = "lf2", view = "area", id = area.id
bsw@211 51 } },
bsw@211 52 text = _"Become a member of this area"
bsw@211 53 }
bsw@211 54 end
bsw@211 55 end }
bsw@211 56 ui.box_col{ class = "right", content = function()
bsw@211 57 if membership then
bsw@211 58 ui.link{
bsw@211 59 module = "membership", action = "update", params = { area_id = area.id, delete = true },
bsw@211 60 routing = { default = {
bsw@211 61 mode = "redirect", module = "lf2", view = "area", id = area.id
bsw@211 62 } },
bsw@211 63 text = _"Give up membership"
bsw@211 64 }
bsw@211 65 end
bsw@211 66 if not trustees then
bsw@211 67 if membership then
bsw@211 68 slot.put(" · ")
bsw@211 69 end
bsw@211 70 ui.link{ text = _"Delegate area...", module = "lf2", view = "delegation" }
bsw@211 71 end
bsw@211 72 end }
bsw@211 73 end }
bsw@211 74
bsw@211 75 end }

Impressum / About Us