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