liquid_feedback_frontend

annotate app/main/area/_head.lua @ 562:051d0244c60f

Added tag v2.beta9 for changeset 12e504938643
author bsw
date Tue Jun 19 21:33:11 2012 +0200 (2012-06-19)
parents 5ca9de94cb13
children 7dc5ab12bfe3
rev   line source
bsw@525 1 local area = param.get("area", "table")
bsw@525 2
bsw@529 3 local show_content = param.get("show_content", atom.boolean)
bsw@529 4
bsw@529 5 area:load_delegation_info_once_for_member_id(app.session.member_id)
bsw@529 6
bsw@525 7 execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
bsw@525 8
bsw@526 9 ui.container{ attr = { class = "area_head" }, content = function()
bsw@525 10
bsw@526 11 execute.view{ module = "delegation", view = "_info", params = { area = area } }
bsw@525 12
bsw@526 13 ui.container{ attr = { class = "title" }, content = function()
bsw@526 14 -- area name
bsw@526 15 ui.link{
bsw@526 16 module = "area", view = "show", id = area.id,
bsw@526 17 attr = { class = "area_name" }, content = area.name
bsw@526 18 }
bsw@526 19 end }
bsw@526 20
bsw@529 21 if show_content then
bsw@529 22
bsw@529 23 ui.container{ attr = { class = "content" }, content = function()
bsw@525 24
bsw@529 25 -- actions (members with appropriate voting right only)
bsw@529 26 if app.session.member_id then
bsw@525 27
bsw@529 28 -- membership
bsw@529 29 local membership = Membership:by_pk(area.id, app.session.member.id)
bsw@525 30
bsw@529 31 if membership then
bsw@529 32
bsw@529 33 ui.tag{ content = _"You are participating in this area" }
bsw@529 34
bsw@529 35 slot.put(" ")
bsw@529 36
bsw@529 37 ui.tag{ content = function()
bsw@529 38 slot.put("(")
bsw@529 39 ui.link{
bsw@529 40 text = _"Withdraw",
bsw@529 41 module = "membership",
bsw@529 42 action = "update",
bsw@529 43 params = { area_id = area.id, delete = true },
bsw@529 44 routing = {
bsw@529 45 default = {
bsw@529 46 mode = "redirect",
bsw@529 47 module = request.get_module(),
bsw@529 48 view = request.get_view(),
bsw@529 49 id = param.get_id_cgi(),
bsw@529 50 params = param.get_all_cgi()
bsw@529 51 }
bsw@529 52 }
bsw@529 53 }
bsw@529 54 slot.put(")")
bsw@529 55 end }
bsw@529 56
bsw@529 57
bsw@529 58 elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
bsw@526 59 ui.link{
bsw@529 60 text = _"Participate in this area",
bsw@529 61 module = "membership",
bsw@529 62 action = "update",
bsw@529 63 params = { area_id = area.id },
bsw@528 64 routing = {
bsw@528 65 default = {
bsw@528 66 mode = "redirect",
bsw@528 67 module = request.get_module(),
bsw@528 68 view = request.get_view(),
bsw@528 69 id = param.get_id_cgi(),
bsw@528 70 params = param.get_all_cgi()
bsw@528 71 }
bsw@528 72 }
bsw@526 73 }
bsw@529 74
bsw@529 75 end
bsw@529 76
bsw@529 77 slot.put(" · ")
bsw@529 78 if area.delegation_info.own_delegation_scope ~= "area" then
bsw@529 79 ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } }
bsw@529 80 else
bsw@529 81 ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } }
bsw@529 82 end
bsw@526 83 slot.put(" · ")
bsw@525 84
bsw@529 85 -- create new issue
bsw@529 86 if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
bsw@529 87 ui.link{
bsw@529 88 content = function()
bsw@529 89 slot.put(_"Create new issue")
bsw@529 90 end,
bsw@529 91 module = "initiative",
bsw@529 92 view = "new",
bsw@529 93 params = { area_id = area.id }
bsw@525 94 }
bsw@529 95 end
bsw@525 96
bsw@525 97 end
bsw@525 98
bsw@529 99 end }
bsw@526 100
bsw@529 101 else
bsw@529 102 slot.put("<br />")
bsw@529 103 end
bsw@526 104
bsw@526 105 end }

Impressum / About Us