liquid_feedback_frontend
diff app/main/area/_head.lua @ 529:5ca9de94cb13
Delegation preview when setting delegation, optical enhancements, typos fixed
author | bsw |
---|---|
date | Sun May 20 19:43:01 2012 +0200 (2012-05-20) |
parents | 305329da1c75 |
children | 7dc5ab12bfe3 |
line diff
1.1 --- a/app/main/area/_head.lua Fri May 18 21:03:10 2012 +0200 1.2 +++ b/app/main/area/_head.lua Sun May 20 19:43:01 2012 +0200 1.3 @@ -1,5 +1,9 @@ 1.4 local area = param.get("area", "table") 1.5 1.6 +local show_content = param.get("show_content", atom.boolean) 1.7 + 1.8 +area:load_delegation_info_once_for_member_id(app.session.member_id) 1.9 + 1.10 execute.view{ module = "unit", view = "_head", params = { unit = area.unit } } 1.11 1.12 ui.container{ attr = { class = "area_head" }, content = function() 1.13 @@ -14,27 +18,49 @@ 1.14 } 1.15 end } 1.16 1.17 - ui.container{ attr = { class = "content" }, content = function() 1.18 + if show_content then 1.19 + 1.20 + ui.container{ attr = { class = "content" }, content = function() 1.21 1.22 - -- actions (members with appropriate voting right only) 1.23 - if app.session.member_id then 1.24 + -- actions (members with appropriate voting right only) 1.25 + if app.session.member_id then 1.26 1.27 - -- membership 1.28 - local membership = Membership:by_pk(area.id, app.session.member.id) 1.29 + -- membership 1.30 + local membership = Membership:by_pk(area.id, app.session.member.id) 1.31 1.32 - if membership then 1.33 - 1.34 - ui.tag{ content = _"You are participating in this area" } 1.35 - 1.36 - slot.put(" ") 1.37 - 1.38 - ui.tag{ content = function() 1.39 - slot.put("(") 1.40 + if membership then 1.41 + 1.42 + ui.tag{ content = _"You are participating in this area" } 1.43 + 1.44 + slot.put(" ") 1.45 + 1.46 + ui.tag{ content = function() 1.47 + slot.put("(") 1.48 + ui.link{ 1.49 + text = _"Withdraw", 1.50 + module = "membership", 1.51 + action = "update", 1.52 + params = { area_id = area.id, delete = true }, 1.53 + routing = { 1.54 + default = { 1.55 + mode = "redirect", 1.56 + module = request.get_module(), 1.57 + view = request.get_view(), 1.58 + id = param.get_id_cgi(), 1.59 + params = param.get_all_cgi() 1.60 + } 1.61 + } 1.62 + } 1.63 + slot.put(")") 1.64 + end } 1.65 + 1.66 + 1.67 + elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.68 ui.link{ 1.69 - text = _"Withdraw", 1.70 - module = "membership", 1.71 - action = "update", 1.72 - params = { area_id = area.id, delete = true }, 1.73 + text = _"Participate in this area", 1.74 + module = "membership", 1.75 + action = "update", 1.76 + params = { area_id = area.id }, 1.77 routing = { 1.78 default = { 1.79 mode = "redirect", 1.80 @@ -45,46 +71,35 @@ 1.81 } 1.82 } 1.83 } 1.84 - slot.put(")") 1.85 - end } 1.86 - 1.87 + 1.88 + end 1.89 + 1.90 + slot.put(" · ") 1.91 + if area.delegation_info.own_delegation_scope ~= "area" then 1.92 + ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } } 1.93 + else 1.94 + ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } } 1.95 + end 1.96 slot.put(" · ") 1.97 1.98 - elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.99 - ui.link{ 1.100 - text = _"Participate in this area", 1.101 - module = "membership", 1.102 - action = "update", 1.103 - params = { area_id = area.id }, 1.104 - routing = { 1.105 - default = { 1.106 - mode = "redirect", 1.107 - module = request.get_module(), 1.108 - view = request.get_view(), 1.109 - id = param.get_id_cgi(), 1.110 - params = param.get_all_cgi() 1.111 - } 1.112 + -- create new issue 1.113 + if app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.114 + ui.link{ 1.115 + content = function() 1.116 + slot.put(_"Create new issue") 1.117 + end, 1.118 + module = "initiative", 1.119 + view = "new", 1.120 + params = { area_id = area.id } 1.121 } 1.122 - } 1.123 - 1.124 - slot.put(" · ") 1.125 + end 1.126 1.127 end 1.128 1.129 - -- create new issue 1.130 - if app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.131 - ui.link{ 1.132 - content = function() 1.133 - slot.put(_"Create new issue") 1.134 - end, 1.135 - module = "initiative", 1.136 - view = "new", 1.137 - params = { area_id = area.id } 1.138 - } 1.139 - end 1.140 + end } 1.141 1.142 - end 1.143 + else 1.144 + slot.put("<br />") 1.145 + end 1.146 1.147 - end } 1.148 - 1.149 end } 1.150 \ No newline at end of file