liquid_feedback_frontend
view app/main/issue/show_tab.lua @ 159:5d797c6706d5
implement quorum display
show the initiative quorum as a small 1px line in bargraph
allow to update your support on the diff page
better linked title in diff page
show absolute quorum numbers in detail pages of issue and initiative
show the initiative quorum as a small 1px line in bargraph
allow to update your support on the diff page
better linked title in diff page
show absolute quorum numbers in detail pages of issue and initiative
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Sat Oct 09 03:42:48 2010 +0200 (2010-10-09) |
parents | 0849be391140 |
children | 2dc13655afca |
line source
1 local issue
2 if request.get_json_request_slots() then
3 issue = Issue:by_id(param.get("issue_id"))
4 else
5 issue = param.get("issue", "table")
6 end
8 local voting_requested_percentage = 0
9 if issue.vote_later and issue.population and issue.population > 0 then
10 voting_requested_percentage = math.ceil(issue.vote_later / issue.population * 100)
11 end
13 local interested_members_selector = issue:get_reference_selector("interested_members_snapshot")
14 :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id")
15 :add_field("direct_interest_snapshot.weight")
16 :add_where("direct_interest_snapshot.event = issue.latest_snapshot_event")
18 local voting_requests_selector = issue:get_reference_selector("interested_members_snapshot")
19 :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id")
20 :add_where("direct_interest_snapshot.voting_requested = false")
21 :add_where("direct_interest_snapshot.event = issue.latest_snapshot_event")
23 local delegations_selector = issue:get_reference_selector("delegations")
25 local tabs = {
26 module = "issue",
27 view = "show_tab",
28 static_params = { issue_id = issue.id },
29 }
31 if app.session.member_id then
32 tabs[#tabs+1] =
33 {
34 name = "interested_members",
35 label = _"Interested members" .. " (" .. tostring(interested_members_selector:count()) .. ")" ,
36 icon = { static = "icons/16/eye.png" },
37 module = "member",
38 view = "_list",
39 params = {
40 issue = issue,
41 members_selector = interested_members_selector
42 }
43 }
45 tabs[#tabs+1] =
46 {
47 name = "voting_requests",
48 label = _"Vote later requests" .. " (" .. tostring(voting_requests_selector:count()) .. ") (" .. tostring(voting_requested_percentage) .. "%)",
49 icon = { static = "icons/16/clock_play.png" },
50 module = "member",
51 view = "_list",
52 params = {
53 issue = issue,
54 members_selector = voting_requests_selector
55 }
56 }
58 tabs[#tabs+1] =
59 {
60 name = "delegations",
61 label = _"Delegations" .. " (" .. tostring(delegations_selector:count()) .. ")" ,
62 icon = { static = "icons/16/table_go.png" },
63 module = "delegation",
64 view = "_list",
65 params = { delegations_selector = delegations_selector }
66 }
67 end
69 tabs[#tabs+1] =
70 {
71 name = "details",
72 label = _"Details",
73 icon = { static = "icons/16/magnifier.png" },
74 module = "issue",
75 view = "_details",
76 params = { issue = issue }
77 }
79 ui.tabs(tabs)