# HG changeset patch # User bsw # Date 1330262127 -3600 # Node ID 22e4e26717acd46bfd6c4993a56b3ee109d0a5b8 # Parent cb9ccdd024f243d4a46de536c1f7e084929492fe Show issues, members and delegations for units diff -r cb9ccdd024f2 -r 22e4e26717ac app/main/area/list.lua --- a/app/main/area/list.lua Sat Feb 25 22:29:33 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -local unit_id = config.single_unit_id or param.get("unit_id", atom.integer) - -local areas_selector = Area:build_selector{ active = true, unit_id = unit_id } -areas_selector:add_order_by("member_weight DESC") - -local unit = Unit:by_id(unit_id) - - -if not config.single_unit_id then - slot.put_into("title", unit.name) -else - slot.put_into("title", encode.html(config.app_title)) -end - - -if not app.session.member_id and config.motd_public then - local help_text = config.motd_public - ui.container{ - attr = { class = "wiki motd" }, - content = function() - slot.put(format.wiki_text(help_text)) - end - } -end - -util.help("area.list", _"Area list") - -if app.session.member_id then - execute.view{ - module = "delegation", - view = "_show_box", - params = { unit_id = unit_id } - } -end - - -execute.view{ - module = "area", - view = "_list", - params = { areas_selector = areas_selector } -} diff -r cb9ccdd024f2 -r 22e4e26717ac app/main/area/show.lua --- a/app/main/area/show.lua Sat Feb 25 22:29:33 2012 +0100 +++ b/app/main/area/show.lua Sun Feb 26 14:15:27 2012 +0100 @@ -23,9 +23,9 @@ slot.put(" · ") ui.link{ content = area.unit.name, - module = "area", - view = "list", - params = { unit_id = area.unit_id } + module = "unit", + view = "show", + id = area.unit_id } end diff -r cb9ccdd024f2 -r 22e4e26717ac app/main/issue/_filters.lua --- a/app/main/issue/_filters.lua Sat Feb 25 22:29:33 2012 +0100 +++ b/app/main/issue/_filters.lua Sun Feb 26 14:15:27 2012 +0100 @@ -102,7 +102,7 @@ end if app.session.member then - filters[#filters+1] = { + local filter = { name = "filter_interest", { name = "any", @@ -133,6 +133,20 @@ }, } + --[[ + if param.get_all_cgi()["filter"] == "finished" then + filter[#filter+1] = { + name = "voted", + label = _"Voted", + selector_modifier = function(selector) + selector:add_where({ "EXISTS (SELECT 1 FROM vote WHERE vote.issue_id = issue.id AND vote.member_id = ?)", member.id }) + end + } + end + --]] + + filters[#filters+1] = filter + local filter_interest = param.get_all_cgi()["filter_interest"] if filter_interest ~= "any" and filter_interest ~= nil and filter_interest ~= "initiated" then @@ -184,7 +198,7 @@ end -if app.session.member and member.id == app.session.member_id and (param.get_all_cgi()["filter"] == "frozen" or param.get_all_cgi()["filter"] == "finished") then +if app.session.member and member.id == app.session.member_id and (param.get_all_cgi()["filter"] == "frozen") then filters[#filters+1] = { name = "filter_voting", { diff -r cb9ccdd024f2 -r 22e4e26717ac app/main/issue/_show_head.lua --- a/app/main/issue/_show_head.lua Sat Feb 25 22:29:33 2012 +0100 +++ b/app/main/issue/_show_head.lua Sun Feb 26 14:15:27 2012 +0100 @@ -30,9 +30,9 @@ slot.put(" · ") ui.link{ content = issue.area.unit.name, - module = "area", - view = "list", - params = { unit_id = issue.area.unit_id } + module = "unit", + view = "show", + id = issue.area.unit_id } end end) diff -r cb9ccdd024f2 -r 22e4e26717ac app/main/member/_area_list.lua --- a/app/main/member/_area_list.lua Sat Feb 25 22:29:33 2012 +0100 +++ b/app/main/member/_area_list.lua Sun Feb 26 14:15:27 2012 +0100 @@ -14,7 +14,7 @@ ui.link{ attr = { class = class }, text = unit.name, - module = "area", view = "list", params = { unit_id = unit.id } + module = "unit", view = "show", id = unit.id } if area_count > 0 then diff -r cb9ccdd024f2 -r 22e4e26717ac app/main/unit/_list.lua --- a/app/main/unit/_list.lua Sat Feb 25 22:29:33 2012 +0100 +++ b/app/main/unit/_list.lua Sun Feb 26 14:15:27 2012 +0100 @@ -8,7 +8,7 @@ for i = 1, unit.depth - 1 do slot.put("     ") end - ui.link{ text = unit.name, module = "area", view = "list", params = { unit_id = unit.id } } + ui.link{ text = unit.name, module = "unit", view = "show", id = unit.id } end } } diff -r cb9ccdd024f2 -r 22e4e26717ac app/main/unit/show.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/main/unit/show.lua Sun Feb 26 14:15:27 2012 +0100 @@ -0,0 +1,92 @@ +local unit_id = config.single_unit_id or param.get_id() + +local unit = Unit:by_id(unit_id) + +if not config.single_unit_id then + slot.put_into("title", unit.name) +else + slot.put_into("title", encode.html(config.app_title)) +end + +if config.single_unit_id and not app.session.member_id and config.motd_public then + local help_text = config.motd_public + ui.container{ + attr = { class = "wiki motd" }, + content = function() + slot.put(format.wiki_text(help_text)) + end + } +end + +util.help("unit.show", _"Unit") + +if app.session.member_id then + execute.view{ + module = "delegation", + view = "_show_box", + params = { unit_id = unit_id } + } +end + + +local areas_selector = Area:build_selector{ active = true, unit_id = unit_id } +areas_selector:add_order_by("member_weight DESC") + +local members_selector = Member:build_selector{ + active = true, + voting_right_for_unit_id = unit.id +} + +local delegations_selector = Delegation:new_selector() + :join("member", "truster", "truster.id = delegation.truster_id AND truster.active") + :join("privilege", "truster_privilege", "truster_privilege.member_id = truster.id AND truster_privilege.voting_right") + :join("member", "trustee", "trustee.id = delegation.trustee_id AND truster.active") + :join("privilege", "trustee_privilege", "trustee_privilege.member_id = trustee.id AND trustee_privilege.voting_right") + :add_where{ "delegation.unit_id = ?", unit.id } + +local issues_selector = Issue:new_selector() + :join("area", nil, "area.id = issue.area_id") + :add_where{ "area.unit_id = ?", unit.id } + + +local tabs = { + module = "unit", + view = "show", + id = unit.id +} + +tabs[#tabs+1] = { + name = "areas", + label = _"Areas", + module = "area", + view = "_list", + params = { areas_selector = areas_selector } +} + +tabs[#tabs+1] = { + name = "issues", + label = _"Issues", + module = "issue", + view = "_list", + params = { issues_selector = issues_selector } +} + +if app.session.member_id then + tabs[#tabs+1] = { + name = "members", + label = _"Members", + module = "member", + view = "_list", + params = { members_selector = members_selector } + } + + tabs[#tabs+1] = { + name = "delegations", + label = _"Delegations", + module = "delegation", + view = "_list", + params = { delegations_selector = delegations_selector } + } +end + +ui.tabs(tabs) \ No newline at end of file diff -r cb9ccdd024f2 -r 22e4e26717ac config/development.lua --- a/config/development.lua Sat Feb 25 22:29:33 2012 +0100 +++ b/config/development.lua Sun Feb 26 14:15:27 2012 +0100 @@ -1,4 +1,4 @@ -config.absolute_base_url = "http://10.1.11.5/lf/" +config.absolute_base_url = "http://localhost/lf/" execute.config("default") @@ -44,8 +44,8 @@ --) config.etherpad = { - base_url = "http://10.1.11.5:9001/", - api_base = "http://127.0.0.1:9001/", + base_url = "http://localhost:9001/", + api_base = "http://localhost:9001/", api_key = "g5XAVrRb5EgPuEqIdVrRNt2Juipx3PoH", group_id = "g.7WDKN3StkEyuWkyN", cookie_path = "/" diff -r cb9ccdd024f2 -r 22e4e26717ac static/style.css --- a/static/style.css Sat Feb 25 22:29:33 2012 +0100 +++ b/static/style.css Sun Feb 26 14:15:27 2012 +0100 @@ -1079,7 +1079,7 @@ .help, .use_terms { - border: 1px solid #bcd; + border-radius: 8px; background-color: #cdf; color: #000; padding: 1ex;