liquid_feedback_frontend
view app/main/issue/show.lua @ 16:559c6be0e1e9
"Vote later" feature; Refactored interest box
author | bsw |
---|---|
date | Tue Feb 02 00:10:17 2010 +0100 (2010-02-02) |
parents | afd9f769c7ae |
children | 00d1004545f1 |
line source
1 local issue = Issue:by_id(param.get_id())
3 execute.view{
4 module = "issue",
5 view = "_show_head",
6 params = { issue = issue }
7 }
9 util.help("issue.show")
11 local voting_requested_percentage = 0
12 if issue.vote_later and issue.population and issue.population > 0 then
13 voting_requested_percentage = math.ceil(issue.vote_later / issue.population * 100)
14 end
15 local voting_requested_string = "(" .. tostring(voting_requested_percentage) .. "%)"
17 ui.tabs{
18 {
19 name = "initiatives",
20 label = _"Initiatives",
21 content = function()
22 execute.view{
23 module = "initiative",
24 view = "_list",
25 params = {
26 issue = issue,
27 initiatives_selector = issue:get_reference_selector("initiatives")
28 }
29 }
30 slot.put("<br />")
31 if not issue.fully_frozen and not issue.closed then
32 ui.link{
33 attr = { class = "action" },
34 content = function()
35 ui.image{ static = "icons/16/script_add.png" }
36 slot.put(_"Add new initiative to issue")
37 end,
38 module = "initiative",
39 view = "new",
40 params = { issue_id = issue.id }
41 }
42 end
43 end
44 },
45 {
46 name = "interested_members",
47 label = _"Interested members",
48 content = function()
49 execute.view{
50 module = "member",
51 view = "_list",
52 params = {
53 issue = issue,
54 members_selector = issue:get_reference_selector("interested_members_snapshot")
55 :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id")
56 :add_field("direct_interest_snapshot.weight")
57 :add_where("direct_interest_snapshot.event = issue.latest_snapshot_event")
58 }
59 }
60 end
61 },
62 {
63 name = "delegations",
64 label = _"Delegations",
65 content = function()
66 execute.view{
67 module = "delegation",
68 view = "_list",
69 params = { delegations_selector = issue:get_reference_selector("delegations") }
70 }
71 end
72 },
73 {
74 name = "voting_requests",
75 label = _"Vote later requests" .. " " .. voting_requested_string,
76 content = function()
77 execute.view{
78 module = "member",
79 view = "_list",
80 params = {
81 issue = issue,
82 members_selector = issue:get_reference_selector("interested_members_snapshot")
83 :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id")
84 :add_where("direct_interest_snapshot.voting_requested = false")
85 }
86 }
87 end
88 },
89 {
90 name = "details",
91 label = _"Details",
92 content = function()
93 local policy = issue.policy
94 ui.form{
95 record = issue,
96 readonly = true,
97 attr = { class = "vertical" },
98 content = function()
99 ui.field.text{ label = _"State", name = "state" }
100 ui.field.timestamp{ label = _"Created at", name = "created" }
101 ui.field.text{ label = _"Admission time", value = policy.admission_time }
102 ui.field.text{
103 label = _"Issue quorum",
104 value = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den)
105 }
106 ui.field.timestamp{ label = _"Accepted at", name = "accepted" }
107 ui.field.text{ label = _"Discussion time", value = policy.discussion_time }
108 ui.field.vote_now{ label = _"Vote now", name = "vote_now" }
109 ui.field.vote_later{ label = _"Vote later", name = "vote_later" }
110 ui.field.timestamp{ label = _"Half frozen at", name = "half_frozen" }
111 ui.field.text{ label = _"Verification time", value = policy.verification_time }
112 ui.field.text{
113 label = _"Initiative quorum",
114 value = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den)
115 }
116 ui.field.timestamp{ label = _"Fully frozen at", name = "fully_frozen" }
117 ui.field.text{ label = _"Voting time", value = policy.voting_time }
118 ui.field.timestamp{ label = _"Closed", name = "closed" }
119 end
120 }
121 ui.form{
122 record = issue.policy,
123 readonly = true,
124 content = function()
125 end
126 }
127 end
128 },
129 }