liquid_feedback_frontend

view app/main/issue/show_tab.lua @ 118:93f4e465b50d

add initiator support in delegation

if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
author Daniel Poelzleithner <poelzi@poelzi.org>
date Mon Sep 20 20:32:04 2010 +0200 (2010-09-20)
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)

Impressum / About Us