liquid_feedback_frontend
changeset 301:22e4e26717ac
Show issues, members and delegations for units
author | bsw |
---|---|
date | Sun Feb 26 14:15:27 2012 +0100 (2012-02-26) |
parents | cb9ccdd024f2 |
children | 12a578e75f3e |
files | app/main/area/list.lua app/main/area/show.lua app/main/issue/_filters.lua app/main/issue/_show_head.lua app/main/member/_area_list.lua app/main/unit/_list.lua app/main/unit/show.lua config/development.lua static/style.css |
line diff
1.1 --- a/app/main/area/list.lua Sat Feb 25 22:29:33 2012 +0100 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,41 +0,0 @@ 1.4 -local unit_id = config.single_unit_id or param.get("unit_id", atom.integer) 1.5 - 1.6 -local areas_selector = Area:build_selector{ active = true, unit_id = unit_id } 1.7 -areas_selector:add_order_by("member_weight DESC") 1.8 - 1.9 -local unit = Unit:by_id(unit_id) 1.10 - 1.11 - 1.12 -if not config.single_unit_id then 1.13 - slot.put_into("title", unit.name) 1.14 -else 1.15 - slot.put_into("title", encode.html(config.app_title)) 1.16 -end 1.17 - 1.18 - 1.19 -if not app.session.member_id and config.motd_public then 1.20 - local help_text = config.motd_public 1.21 - ui.container{ 1.22 - attr = { class = "wiki motd" }, 1.23 - content = function() 1.24 - slot.put(format.wiki_text(help_text)) 1.25 - end 1.26 - } 1.27 -end 1.28 - 1.29 -util.help("area.list", _"Area list") 1.30 - 1.31 -if app.session.member_id then 1.32 - execute.view{ 1.33 - module = "delegation", 1.34 - view = "_show_box", 1.35 - params = { unit_id = unit_id } 1.36 - } 1.37 -end 1.38 - 1.39 - 1.40 -execute.view{ 1.41 - module = "area", 1.42 - view = "_list", 1.43 - params = { areas_selector = areas_selector } 1.44 -}
2.1 --- a/app/main/area/show.lua Sat Feb 25 22:29:33 2012 +0100 2.2 +++ b/app/main/area/show.lua Sun Feb 26 14:15:27 2012 +0100 2.3 @@ -23,9 +23,9 @@ 2.4 slot.put(" · ") 2.5 ui.link{ 2.6 content = area.unit.name, 2.7 - module = "area", 2.8 - view = "list", 2.9 - params = { unit_id = area.unit_id } 2.10 + module = "unit", 2.11 + view = "show", 2.12 + id = area.unit_id 2.13 } 2.14 end 2.15
3.1 --- a/app/main/issue/_filters.lua Sat Feb 25 22:29:33 2012 +0100 3.2 +++ b/app/main/issue/_filters.lua Sun Feb 26 14:15:27 2012 +0100 3.3 @@ -102,7 +102,7 @@ 3.4 end 3.5 3.6 if app.session.member then 3.7 - filters[#filters+1] = { 3.8 + local filter = { 3.9 name = "filter_interest", 3.10 { 3.11 name = "any", 3.12 @@ -133,6 +133,20 @@ 3.13 }, 3.14 } 3.15 3.16 + --[[ 3.17 + if param.get_all_cgi()["filter"] == "finished" then 3.18 + filter[#filter+1] = { 3.19 + name = "voted", 3.20 + label = _"Voted", 3.21 + selector_modifier = function(selector) 3.22 + selector:add_where({ "EXISTS (SELECT 1 FROM vote WHERE vote.issue_id = issue.id AND vote.member_id = ?)", member.id }) 3.23 + end 3.24 + } 3.25 + end 3.26 + --]] 3.27 + 3.28 + filters[#filters+1] = filter 3.29 + 3.30 local filter_interest = param.get_all_cgi()["filter_interest"] 3.31 3.32 if filter_interest ~= "any" and filter_interest ~= nil and filter_interest ~= "initiated" then 3.33 @@ -184,7 +198,7 @@ 3.34 3.35 end 3.36 3.37 -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 3.38 +if app.session.member and member.id == app.session.member_id and (param.get_all_cgi()["filter"] == "frozen") then 3.39 filters[#filters+1] = { 3.40 name = "filter_voting", 3.41 {
4.1 --- a/app/main/issue/_show_head.lua Sat Feb 25 22:29:33 2012 +0100 4.2 +++ b/app/main/issue/_show_head.lua Sun Feb 26 14:15:27 2012 +0100 4.3 @@ -30,9 +30,9 @@ 4.4 slot.put(" · ") 4.5 ui.link{ 4.6 content = issue.area.unit.name, 4.7 - module = "area", 4.8 - view = "list", 4.9 - params = { unit_id = issue.area.unit_id } 4.10 + module = "unit", 4.11 + view = "show", 4.12 + id = issue.area.unit_id 4.13 } 4.14 end 4.15 end)
5.1 --- a/app/main/member/_area_list.lua Sat Feb 25 22:29:33 2012 +0100 5.2 +++ b/app/main/member/_area_list.lua Sun Feb 26 14:15:27 2012 +0100 5.3 @@ -14,7 +14,7 @@ 5.4 ui.link{ 5.5 attr = { class = class }, 5.6 text = unit.name, 5.7 - module = "area", view = "list", params = { unit_id = unit.id } 5.8 + module = "unit", view = "show", id = unit.id 5.9 } 5.10 5.11 if area_count > 0 then
6.1 --- a/app/main/unit/_list.lua Sat Feb 25 22:29:33 2012 +0100 6.2 +++ b/app/main/unit/_list.lua Sun Feb 26 14:15:27 2012 +0100 6.3 @@ -8,7 +8,7 @@ 6.4 for i = 1, unit.depth - 1 do 6.5 slot.put(" ") 6.6 end 6.7 - ui.link{ text = unit.name, module = "area", view = "list", params = { unit_id = unit.id } } 6.8 + ui.link{ text = unit.name, module = "unit", view = "show", id = unit.id } 6.9 end 6.10 } 6.11 }
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/app/main/unit/show.lua Sun Feb 26 14:15:27 2012 +0100 7.3 @@ -0,0 +1,92 @@ 7.4 +local unit_id = config.single_unit_id or param.get_id() 7.5 + 7.6 +local unit = Unit:by_id(unit_id) 7.7 + 7.8 +if not config.single_unit_id then 7.9 + slot.put_into("title", unit.name) 7.10 +else 7.11 + slot.put_into("title", encode.html(config.app_title)) 7.12 +end 7.13 + 7.14 +if config.single_unit_id and not app.session.member_id and config.motd_public then 7.15 + local help_text = config.motd_public 7.16 + ui.container{ 7.17 + attr = { class = "wiki motd" }, 7.18 + content = function() 7.19 + slot.put(format.wiki_text(help_text)) 7.20 + end 7.21 + } 7.22 +end 7.23 + 7.24 +util.help("unit.show", _"Unit") 7.25 + 7.26 +if app.session.member_id then 7.27 + execute.view{ 7.28 + module = "delegation", 7.29 + view = "_show_box", 7.30 + params = { unit_id = unit_id } 7.31 + } 7.32 +end 7.33 + 7.34 + 7.35 +local areas_selector = Area:build_selector{ active = true, unit_id = unit_id } 7.36 +areas_selector:add_order_by("member_weight DESC") 7.37 + 7.38 +local members_selector = Member:build_selector{ 7.39 + active = true, 7.40 + voting_right_for_unit_id = unit.id 7.41 +} 7.42 + 7.43 +local delegations_selector = Delegation:new_selector() 7.44 + :join("member", "truster", "truster.id = delegation.truster_id AND truster.active") 7.45 + :join("privilege", "truster_privilege", "truster_privilege.member_id = truster.id AND truster_privilege.voting_right") 7.46 + :join("member", "trustee", "trustee.id = delegation.trustee_id AND truster.active") 7.47 + :join("privilege", "trustee_privilege", "trustee_privilege.member_id = trustee.id AND trustee_privilege.voting_right") 7.48 + :add_where{ "delegation.unit_id = ?", unit.id } 7.49 + 7.50 +local issues_selector = Issue:new_selector() 7.51 + :join("area", nil, "area.id = issue.area_id") 7.52 + :add_where{ "area.unit_id = ?", unit.id } 7.53 + 7.54 + 7.55 +local tabs = { 7.56 + module = "unit", 7.57 + view = "show", 7.58 + id = unit.id 7.59 +} 7.60 + 7.61 +tabs[#tabs+1] = { 7.62 + name = "areas", 7.63 + label = _"Areas", 7.64 + module = "area", 7.65 + view = "_list", 7.66 + params = { areas_selector = areas_selector } 7.67 +} 7.68 + 7.69 +tabs[#tabs+1] = { 7.70 + name = "issues", 7.71 + label = _"Issues", 7.72 + module = "issue", 7.73 + view = "_list", 7.74 + params = { issues_selector = issues_selector } 7.75 +} 7.76 + 7.77 +if app.session.member_id then 7.78 + tabs[#tabs+1] = { 7.79 + name = "members", 7.80 + label = _"Members", 7.81 + module = "member", 7.82 + view = "_list", 7.83 + params = { members_selector = members_selector } 7.84 + } 7.85 + 7.86 + tabs[#tabs+1] = { 7.87 + name = "delegations", 7.88 + label = _"Delegations", 7.89 + module = "delegation", 7.90 + view = "_list", 7.91 + params = { delegations_selector = delegations_selector } 7.92 + } 7.93 +end 7.94 + 7.95 +ui.tabs(tabs) 7.96 \ No newline at end of file
8.1 --- a/config/development.lua Sat Feb 25 22:29:33 2012 +0100 8.2 +++ b/config/development.lua Sun Feb 26 14:15:27 2012 +0100 8.3 @@ -1,4 +1,4 @@ 8.4 -config.absolute_base_url = "http://10.1.11.5/lf/" 8.5 +config.absolute_base_url = "http://localhost/lf/" 8.6 8.7 execute.config("default") 8.8 8.9 @@ -44,8 +44,8 @@ 8.10 --) 8.11 8.12 config.etherpad = { 8.13 - base_url = "http://10.1.11.5:9001/", 8.14 - api_base = "http://127.0.0.1:9001/", 8.15 + base_url = "http://localhost:9001/", 8.16 + api_base = "http://localhost:9001/", 8.17 api_key = "g5XAVrRb5EgPuEqIdVrRNt2Juipx3PoH", 8.18 group_id = "g.7WDKN3StkEyuWkyN", 8.19 cookie_path = "/"