liquid_feedback_frontend

annotate app/main/lf2/_sidebar_unit.lua @ 215:1dab81353eb1

More enhancements for second generation frontend
author bsw
date Sat Mar 05 15:34:17 2011 +0100 (2011-03-05)
parents 3e4ad069847a
children 73dbc9e2bfd4
rev   line source
bsw@215 1 local current_area_id = param.get("current_area_id", atom.integer)
bsw@215 2 local current_phase = param.get_all_cgi()["phase"]
bsw@215 3
bsw@215 4 local member_areas_selector = Area:build_selector{
bsw@215 5 member_id = app.session.member_id,
bsw@215 6 order = "name"
bsw@215 7 }
bsw@215 8 local other_areas_selector = Area:build_selector{
bsw@215 9 not_member_id = app.session.member_id,
bsw@215 10 order = "name"
bsw@215 11 }
bsw@215 12
bsw@215 13 local unit = {}
bsw@212 14
bsw@212 15 local trustees = Member:new_selector()
bsw@212 16 :add_field("delegation_chain.*")
bsw@212 17 :join("delegation_chain(" .. tostring(app.session.member.id) .. ", NULL, NULL)", "delegation_chain", "member.id = delegation_chain.member_id")
bsw@212 18 :add_order_by("index")
bsw@212 19 :exec()
bsw@212 20
bsw@215 21 local row_count = member_areas_selector:count() + other_areas_selector:count() + 4
bsw@215 22 if #trustees > 1 then
bsw@215 23 row_count = row_count + 1
bsw@215 24 end
bsw@215 25
bsw@215 26 ui.box{ row_count = row_count, content = function()
bsw@212 27 ui.box_row{ class = "head", content = function()
bsw@212 28 ui.box_col{ class = "head", content = _"DE / Berlin / Friedrichshain-Kreuzberg" }
bsw@212 29 end }
bsw@212 30
bsw@212 31 if #trustees > 1 then
bsw@212 32 ui.box_row{ content = function() ui.box_col{ content = function()
bsw@212 33 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
bsw@212 34 end } end }
bsw@212 35 end
bsw@212 36
bsw@212 37 ui.box_row{ content = function() ui.box_col{ content = function()
bsw@212 38 if trustees[1].scope_out == "global" then
bsw@215 39 text = _"Change or revoke unit delegation"
bsw@212 40 else
bsw@215 41 text = _"Set unit delegation"
bsw@212 42 end
bsw@212 43 ui.link{
bsw@212 44 text = text,
bsw@212 45 module = "lf2", view = "delegation", params = { unit_id = unit.id }
bsw@212 46 }
bsw@212 47 end } end }
bsw@212 48
bsw@215 49
bsw@215 50 ui.form{
bsw@215 51 method = "get",
bsw@215 52 content = function()
bsw@215 53
bsw@215 54 ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = function()
bsw@215 55 ui.link{ text = _"Areas, you are member of", module = "lf2", view = "index" }
bsw@215 56 end } end }
bsw@215 57
bsw@215 58 execute.view{
bsw@215 59 module = "lf2", view = "_areas", params = {
bsw@215 60 areas_selector = member_areas_selector,
bsw@215 61 current_area_id = current_area_id,
bsw@215 62 current_phase = current_phase
bsw@215 63 }
bsw@215 64 }
bsw@215 65
bsw@215 66 ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = function()
bsw@215 67 ui.link{ content = _"Other areas", module = "lf2", view = "index" }
bsw@215 68 end } end }
bsw@215 69
bsw@215 70 execute.view{
bsw@215 71 module = "lf2", view = "_areas", params = {
bsw@215 72 areas_selector = other_areas_selector,
bsw@215 73 current_area_id = current_area_id,
bsw@215 74 current_phase = current_phase
bsw@215 75 }
bsw@215 76 }
bsw@215 77
bsw@215 78 end
bsw@215 79 }
bsw@215 80
bsw@212 81 end }
bsw@215 82
bsw@215 83 execute.view{ module = "lf2", view = "_search", params = { area = area } }

Impressum / About Us