# HG changeset patch # User bsw # Date 1337361705 -7200 # Node ID 18cd8595459b24dba1214e2c2b68f502e5b1f7d0 # Parent 63d6549cc00b231a14a896766b5714c4583029b2 Fixes for public access diff -r 63d6549cc00b -r 18cd8595459b app/main/area/_head.lua --- a/app/main/area/_head.lua Fri May 18 19:07:07 2012 +0200 +++ b/app/main/area/_head.lua Fri May 18 19:21:45 2012 +0200 @@ -2,84 +2,80 @@ execute.view{ module = "unit", view = "_head", params = { unit = area.unit } } -slot.select("head", function() +ui.container{ attr = { class = "area_head" }, content = function() - ui.container{ attr = { class = "area_head" }, content = function() - - execute.view{ module = "delegation", view = "_info", params = { area = area } } + execute.view{ module = "delegation", view = "_info", params = { area = area } } - ui.container{ attr = { class = "title" }, content = function() - -- area name - ui.link{ - module = "area", view = "show", id = area.id, - attr = { class = "area_name" }, content = area.name - } - end } - - ui.container{ attr = { class = "content" }, content = function() + ui.container{ attr = { class = "title" }, content = function() + -- area name + ui.link{ + module = "area", view = "show", id = area.id, + attr = { class = "area_name" }, content = area.name + } + end } + + ui.container{ attr = { class = "content" }, content = function() - -- actions (members with appropriate voting right only) - if app.session.member_id then + -- actions (members with appropriate voting right only) + if app.session.member_id then - -- membership - local membership = Membership:by_pk(area.id, app.session.member.id) + -- membership + local membership = Membership:by_pk(area.id, app.session.member.id) - if membership then - - ui.tag{ content = _"You are member" } - - slot.put(" ") - - ui.tag{ content = function() - slot.put("(") - ui.link{ - text = _"Withdraw", - module = "membership", - action = "update", - params = { area_id = area.id, delete = true }, - routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } - } - slot.put(")") - end } - - slot.put(" · ") + if membership then + + ui.tag{ content = _"You are member" } + + slot.put(" ") + + ui.tag{ content = function() + slot.put("(") + ui.link{ + text = _"Withdraw", + module = "membership", + action = "update", + params = { area_id = area.id, delete = true }, + routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } + } + slot.put(")") + end } + + slot.put(" · ") - elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then - ui.link{ - text = _"Become a member", - module = "membership", - action = "update", - params = { area_id = area.id }, - routing = { - default = { - mode = "redirect", - module = "area", - view = "show", - id = area.id - } + elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then + ui.link{ + text = _"Become a member", + module = "membership", + action = "update", + params = { area_id = area.id }, + routing = { + default = { + mode = "redirect", + module = "area", + view = "show", + id = area.id } } - - slot.put(" · ") - - end + } - -- create new issue - if app.session.member:has_voting_right_for_unit_id(area.unit_id) then - ui.link{ - content = function() - slot.put(_"Create new issue") - end, - module = "initiative", - view = "new", - params = { area_id = area.id } - } - end + slot.put(" · ") end - end } - + -- create new issue + if app.session.member:has_voting_right_for_unit_id(area.unit_id) then + ui.link{ + content = function() + slot.put(_"Create new issue") + end, + module = "initiative", + view = "new", + params = { area_id = area.id } + } + end + + end + end } - -end) \ No newline at end of file + +end } \ No newline at end of file diff -r 63d6549cc00b -r 18cd8595459b app/main/area/show.lua --- a/app/main/area/show.lua Fri May 18 19:07:07 2012 +0200 +++ b/app/main/area/show.lua Fri May 18 19:21:45 2012 +0200 @@ -13,7 +13,9 @@ end -execute.view{ module = "area", view = "_head", params = { area = area } } +slot.select("head", function() + execute.view{ module = "area", view = "_head", params = { area = area } } +end) ui.container{ attr = { class = "vertical"}, diff -r 63d6549cc00b -r 18cd8595459b app/main/delegation/_info.lua --- a/app/main/delegation/_info.lua Fri May 18 19:07:07 2012 +0200 +++ b/app/main/delegation/_info.lua Fri May 18 19:21:45 2012 +0200 @@ -1,3 +1,7 @@ +if not app.session.member_id then + return +end + local unit = param.get("unit", "table") local area = param.get("area", "table") local issue = param.get("issue", "table") diff -r 63d6549cc00b -r 18cd8595459b app/main/initiative/show.lua --- a/app/main/initiative/show.lua Fri May 18 19:07:07 2012 +0200 +++ b/app/main/initiative/show.lua Fri May 18 19:21:45 2012 +0200 @@ -8,13 +8,17 @@ app.html_title.subtitle = _("Initiative ##{id}", { id = initiative.id }) -execute.view{ - module = "issue", - view = "_head", - params = { issue = initiative.issue, - initiative = initiative } -} +slot.select("head", function() + execute.view{ + module = "issue", + view = "_head", + params = { issue = initiative.issue, + initiative = initiative } + } + +end) + if not initiative then initiative = Initiative:by_id(param.get_id()) expanded = true diff -r 63d6549cc00b -r 18cd8595459b app/main/issue/show.lua --- a/app/main/issue/show.lua Fri May 18 19:07:07 2012 +0200 +++ b/app/main/issue/show.lua Fri May 18 19:21:45 2012 +0200 @@ -4,11 +4,9 @@ app.html_title.title = _("Issue ##{id}", { id = issue.id }) end -execute.view{ - module = "area", - view = "_head", - params = { area = issue.area } -} +slot.select("head", function() + execute.view{ module = "area", view = "_head", params = { area = issue.area } } +end) util.help("issue.show") diff -r 63d6549cc00b -r 18cd8595459b app/main/unit/_head.lua --- a/app/main/unit/_head.lua Fri May 18 19:07:07 2012 +0200 +++ b/app/main/unit/_head.lua Fri May 18 19:21:45 2012 +0200 @@ -1,31 +1,32 @@ local unit = param.get("unit", "table") -slot.select("head", function() +ui.container{ attr = { class = "unit_head" }, content = function() - ui.container{ attr = { class = "unit_head" }, content = function() - - execute.view{ module = "delegation", view = "_info", params = { unit = unit } } + execute.view{ module = "delegation", view = "_info", params = { unit = unit } } - ui.container{ attr = { class = "title" }, content = function() - if not config.single_unit_id then - ui.link{ - module = "unit", view = "show", id = unit.id, - attr = { class = "unit_name" }, content = unit.name - } - else - ui.link{ - module = "unit", view = "show", id = unit.id, - attr = { class = "unit_name" }, content = config.app_title - } - end - end } - - ui.container{ attr = { class = "content" }, content = function() - - ui.tag{ content = "1234 Stimmberechtigte" } - - end } - + ui.container{ attr = { class = "title" }, content = function() + if not config.single_unit_id then + ui.link{ + module = "unit", view = "show", id = unit.id, + attr = { class = "unit_name" }, content = unit.name + } + else + ui.link{ + module = "unit", view = "show", id = unit.id, + attr = { class = "unit_name" }, content = config.app_title + } + end end } -end ) \ No newline at end of file + ui.container{ attr = { class = "content" }, content = function() + + if app.session.member_id and app.session.member:has_voting_right_for_unit_id(unit.id) then + ui.tag{ content = _"You have voting privileges" } + slot.put(" · ") + end + + ui.tag{ content = "1234 Stimmberechtigte" } + + end } + +end } diff -r 63d6549cc00b -r 18cd8595459b app/main/unit/show.lua --- a/app/main/unit/show.lua Fri May 18 19:07:07 2012 +0200 +++ b/app/main/unit/show.lua Fri May 18 19:21:45 2012 +0200 @@ -2,7 +2,9 @@ local unit = Unit:by_id(unit_id) -execute.view{ module = "unit", view = "_head", params = { unit = unit } } +slot.select("head", function() + execute.view{ module = "unit", view = "_head", params = { unit = unit } } +end) if config.single_unit_id and not app.session.member_id and config.motd_public then local help_text = config.motd_public