liquid_feedback_frontend
changeset 526:18cd8595459b
Fixes for public access
author | bsw |
---|---|
date | Fri May 18 19:21:45 2012 +0200 (2012-05-18) |
parents | 63d6549cc00b |
children | 4cee33ad5e16 |
files | app/main/area/_head.lua app/main/area/show.lua app/main/delegation/_info.lua app/main/initiative/show.lua app/main/issue/show.lua app/main/unit/_head.lua app/main/unit/show.lua |
line diff
1.1 --- a/app/main/area/_head.lua Fri May 18 19:07:07 2012 +0200 1.2 +++ b/app/main/area/_head.lua Fri May 18 19:21:45 2012 +0200 1.3 @@ -2,84 +2,80 @@ 1.4 1.5 execute.view{ module = "unit", view = "_head", params = { unit = area.unit } } 1.6 1.7 -slot.select("head", function() 1.8 +ui.container{ attr = { class = "area_head" }, content = function() 1.9 1.10 - ui.container{ attr = { class = "area_head" }, content = function() 1.11 - 1.12 - execute.view{ module = "delegation", view = "_info", params = { area = area } } 1.13 + execute.view{ module = "delegation", view = "_info", params = { area = area } } 1.14 1.15 - ui.container{ attr = { class = "title" }, content = function() 1.16 - -- area name 1.17 - ui.link{ 1.18 - module = "area", view = "show", id = area.id, 1.19 - attr = { class = "area_name" }, content = area.name 1.20 - } 1.21 - end } 1.22 - 1.23 - ui.container{ attr = { class = "content" }, content = function() 1.24 + ui.container{ attr = { class = "title" }, content = function() 1.25 + -- area name 1.26 + ui.link{ 1.27 + module = "area", view = "show", id = area.id, 1.28 + attr = { class = "area_name" }, content = area.name 1.29 + } 1.30 + end } 1.31 + 1.32 + ui.container{ attr = { class = "content" }, content = function() 1.33 1.34 - -- actions (members with appropriate voting right only) 1.35 - if app.session.member_id then 1.36 + -- actions (members with appropriate voting right only) 1.37 + if app.session.member_id then 1.38 1.39 - -- membership 1.40 - local membership = Membership:by_pk(area.id, app.session.member.id) 1.41 + -- membership 1.42 + local membership = Membership:by_pk(area.id, app.session.member.id) 1.43 1.44 - if membership then 1.45 - 1.46 - ui.tag{ content = _"You are member" } 1.47 - 1.48 - slot.put(" ") 1.49 - 1.50 - ui.tag{ content = function() 1.51 - slot.put("(") 1.52 - ui.link{ 1.53 - text = _"Withdraw", 1.54 - module = "membership", 1.55 - action = "update", 1.56 - params = { area_id = area.id, delete = true }, 1.57 - routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } 1.58 - } 1.59 - slot.put(")") 1.60 - end } 1.61 - 1.62 - slot.put(" · ") 1.63 + if membership then 1.64 + 1.65 + ui.tag{ content = _"You are member" } 1.66 + 1.67 + slot.put(" ") 1.68 + 1.69 + ui.tag{ content = function() 1.70 + slot.put("(") 1.71 + ui.link{ 1.72 + text = _"Withdraw", 1.73 + module = "membership", 1.74 + action = "update", 1.75 + params = { area_id = area.id, delete = true }, 1.76 + routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } 1.77 + } 1.78 + slot.put(")") 1.79 + end } 1.80 + 1.81 + slot.put(" · ") 1.82 1.83 - elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.84 - ui.link{ 1.85 - text = _"Become a member", 1.86 - module = "membership", 1.87 - action = "update", 1.88 - params = { area_id = area.id }, 1.89 - routing = { 1.90 - default = { 1.91 - mode = "redirect", 1.92 - module = "area", 1.93 - view = "show", 1.94 - id = area.id 1.95 - } 1.96 + elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.97 + ui.link{ 1.98 + text = _"Become a member", 1.99 + module = "membership", 1.100 + action = "update", 1.101 + params = { area_id = area.id }, 1.102 + routing = { 1.103 + default = { 1.104 + mode = "redirect", 1.105 + module = "area", 1.106 + view = "show", 1.107 + id = area.id 1.108 } 1.109 } 1.110 - 1.111 - slot.put(" · ") 1.112 - 1.113 - end 1.114 + } 1.115 1.116 - -- create new issue 1.117 - if app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.118 - ui.link{ 1.119 - content = function() 1.120 - slot.put(_"Create new issue") 1.121 - end, 1.122 - module = "initiative", 1.123 - view = "new", 1.124 - params = { area_id = area.id } 1.125 - } 1.126 - end 1.127 + slot.put(" · ") 1.128 1.129 end 1.130 1.131 - end } 1.132 - 1.133 + -- create new issue 1.134 + if app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.135 + ui.link{ 1.136 + content = function() 1.137 + slot.put(_"Create new issue") 1.138 + end, 1.139 + module = "initiative", 1.140 + view = "new", 1.141 + params = { area_id = area.id } 1.142 + } 1.143 + end 1.144 + 1.145 + end 1.146 + 1.147 end } 1.148 - 1.149 -end) 1.150 \ No newline at end of file 1.151 + 1.152 +end } 1.153 \ No newline at end of file
2.1 --- a/app/main/area/show.lua Fri May 18 19:07:07 2012 +0200 2.2 +++ b/app/main/area/show.lua Fri May 18 19:21:45 2012 +0200 2.3 @@ -13,7 +13,9 @@ 2.4 end 2.5 2.6 2.7 -execute.view{ module = "area", view = "_head", params = { area = area } } 2.8 +slot.select("head", function() 2.9 + execute.view{ module = "area", view = "_head", params = { area = area } } 2.10 +end) 2.11 2.12 ui.container{ 2.13 attr = { class = "vertical"},
3.1 --- a/app/main/delegation/_info.lua Fri May 18 19:07:07 2012 +0200 3.2 +++ b/app/main/delegation/_info.lua Fri May 18 19:21:45 2012 +0200 3.3 @@ -1,3 +1,7 @@ 3.4 +if not app.session.member_id then 3.5 + return 3.6 +end 3.7 + 3.8 local unit = param.get("unit", "table") 3.9 local area = param.get("area", "table") 3.10 local issue = param.get("issue", "table")
4.1 --- a/app/main/initiative/show.lua Fri May 18 19:07:07 2012 +0200 4.2 +++ b/app/main/initiative/show.lua Fri May 18 19:21:45 2012 +0200 4.3 @@ -8,13 +8,17 @@ 4.4 app.html_title.subtitle = _("Initiative ##{id}", { id = initiative.id }) 4.5 4.6 4.7 -execute.view{ 4.8 - module = "issue", 4.9 - view = "_head", 4.10 - params = { issue = initiative.issue, 4.11 - initiative = initiative } 4.12 -} 4.13 +slot.select("head", function() 4.14 4.15 + execute.view{ 4.16 + module = "issue", 4.17 + view = "_head", 4.18 + params = { issue = initiative.issue, 4.19 + initiative = initiative } 4.20 + } 4.21 + 4.22 +end) 4.23 + 4.24 if not initiative then 4.25 initiative = Initiative:by_id(param.get_id()) 4.26 expanded = true
5.1 --- a/app/main/issue/show.lua Fri May 18 19:07:07 2012 +0200 5.2 +++ b/app/main/issue/show.lua Fri May 18 19:21:45 2012 +0200 5.3 @@ -4,11 +4,9 @@ 5.4 app.html_title.title = _("Issue ##{id}", { id = issue.id }) 5.5 end 5.6 5.7 -execute.view{ 5.8 - module = "area", 5.9 - view = "_head", 5.10 - params = { area = issue.area } 5.11 -} 5.12 +slot.select("head", function() 5.13 + execute.view{ module = "area", view = "_head", params = { area = issue.area } } 5.14 +end) 5.15 5.16 util.help("issue.show") 5.17
6.1 --- a/app/main/unit/_head.lua Fri May 18 19:07:07 2012 +0200 6.2 +++ b/app/main/unit/_head.lua Fri May 18 19:21:45 2012 +0200 6.3 @@ -1,31 +1,32 @@ 6.4 local unit = param.get("unit", "table") 6.5 6.6 -slot.select("head", function() 6.7 +ui.container{ attr = { class = "unit_head" }, content = function() 6.8 6.9 - ui.container{ attr = { class = "unit_head" }, content = function() 6.10 - 6.11 - execute.view{ module = "delegation", view = "_info", params = { unit = unit } } 6.12 + execute.view{ module = "delegation", view = "_info", params = { unit = unit } } 6.13 6.14 - ui.container{ attr = { class = "title" }, content = function() 6.15 - if not config.single_unit_id then 6.16 - ui.link{ 6.17 - module = "unit", view = "show", id = unit.id, 6.18 - attr = { class = "unit_name" }, content = unit.name 6.19 - } 6.20 - else 6.21 - ui.link{ 6.22 - module = "unit", view = "show", id = unit.id, 6.23 - attr = { class = "unit_name" }, content = config.app_title 6.24 - } 6.25 - end 6.26 - end } 6.27 - 6.28 - ui.container{ attr = { class = "content" }, content = function() 6.29 - 6.30 - ui.tag{ content = "1234 Stimmberechtigte" } 6.31 - 6.32 - end } 6.33 - 6.34 + ui.container{ attr = { class = "title" }, content = function() 6.35 + if not config.single_unit_id then 6.36 + ui.link{ 6.37 + module = "unit", view = "show", id = unit.id, 6.38 + attr = { class = "unit_name" }, content = unit.name 6.39 + } 6.40 + else 6.41 + ui.link{ 6.42 + module = "unit", view = "show", id = unit.id, 6.43 + attr = { class = "unit_name" }, content = config.app_title 6.44 + } 6.45 + end 6.46 end } 6.47 6.48 -end ) 6.49 \ No newline at end of file 6.50 + ui.container{ attr = { class = "content" }, content = function() 6.51 + 6.52 + if app.session.member_id and app.session.member:has_voting_right_for_unit_id(unit.id) then 6.53 + ui.tag{ content = _"You have voting privileges" } 6.54 + slot.put(" · ") 6.55 + end 6.56 + 6.57 + ui.tag{ content = "1234 Stimmberechtigte" } 6.58 + 6.59 + end } 6.60 + 6.61 +end }
7.1 --- a/app/main/unit/show.lua Fri May 18 19:07:07 2012 +0200 7.2 +++ b/app/main/unit/show.lua Fri May 18 19:21:45 2012 +0200 7.3 @@ -2,7 +2,9 @@ 7.4 7.5 local unit = Unit:by_id(unit_id) 7.6 7.7 -execute.view{ module = "unit", view = "_head", params = { unit = unit } } 7.8 +slot.select("head", function() 7.9 + execute.view{ module = "unit", view = "_head", params = { unit = unit } } 7.10 +end) 7.11 7.12 if config.single_unit_id and not app.session.member_id and config.motd_public then 7.13 local help_text = config.motd_public