liquid_feedback_frontend

annotate app/main/lf2/_area.lua @ 291:71eed60f6a41

Closed branch of experimental frontend
author jbe
date Sat Feb 25 15:56:55 2012 +0100 (2012-02-25)
parents 73dbc9e2bfd4
children
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@217 7 :join({ "delegation_chain(?, null, ?, null)", app.session.member_id, area.id }, "delegation_chain", "member.id = delegation_chain.member_id")
bsw@211 8 :add_order_by("index")
bsw@211 9 :exec()
bsw@211 10
bsw@217 11
bsw@211 12 ui.box{ class = "area", content = function()
bsw@211 13 ui.box_row{ class = "head", content = function()
bsw@217 14 ui.box_col{ class = "head left name", content = function()
bsw@217 15 if membership then
bsw@217 16 local text = _"You are member of this area"
bsw@217 17 ui.image{ attr = { title = text, alt = text }, static = "lf2/icon_star.png" }
bsw@217 18 else
bsw@217 19 end
bsw@217 20 slot.put(" ")
bsw@217 21 ui.tag{ content = area.name }
bsw@217 22 end }
bsw@212 23 ui.box_col{ class = "right", content = _("#{direct_count}+#{delegated_count} members", {
bsw@211 24 direct_count = area.direct_member_count,
bsw@211 25 delegated_count = area.member_weight - area.direct_member_count
bsw@211 26 } ) }
bsw@211 27 end }
bsw@211 28
bsw@212 29 if #trustees > 1 then
bsw@212 30 ui.box_row{ content = function()
bsw@212 31 ui.box_col{ class = "left", content = function()
bsw@212 32 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
bsw@212 33 end }
bsw@211 34 end }
bsw@212 35 end
bsw@211 36
bsw@211 37 ui.box_row{ content = function()
bsw@211 38 ui.box_col{ class = "left", content = function()
bsw@211 39 if membership then
bsw@217 40 ui.link{
bsw@217 41 module = "membership", action = "update", params = { area_id = area.id, delete = true },
bsw@217 42 routing = { default = {
bsw@217 43 mode = "redirect", module = "lf2", view = "area", id = area.id
bsw@217 44 } },
bsw@217 45 text = _"Give up area membership"
bsw@217 46 }
bsw@211 47 else
bsw@211 48 ui.link{
bsw@211 49 module = "membership", action = "update", params = { area_id = area.id },
bsw@211 50 routing = { default = {
bsw@211 51 mode = "redirect", module = "lf2", view = "area", id = area.id
bsw@211 52 } },
bsw@211 53 text = _"Become a member of this area"
bsw@211 54 }
bsw@211 55 end
bsw@217 56 slot.put(" · ")
bsw@217 57 if trustees[1].scope_out == "area" then
bsw@217 58 text = _"Change or revoke area delegation"
bsw@217 59 else
bsw@217 60 text = _"Set area delegation"
bsw@217 61 end
bsw@217 62 ui.link{
bsw@217 63 text = text,
bsw@217 64 module = "lf2", view = "delegation", params = { area_id = area.id }
bsw@217 65 }
bsw@211 66 end }
bsw@211 67 end }
bsw@211 68
bsw@217 69 if area.description and #area.description > 0 then
bsw@217 70 -- ui.box_row{ class = "description", content = function() ui.box_col{ content = area.description } end }
bsw@217 71 end
bsw@217 72
bsw@211 73 end }

Impressum / About Us