| rev |
line source |
|
bsw/jbe@19
|
1 local initiative = param.get("initiative", "table")
|
|
bsw@274
|
2 local selected = param.get("selected", atom.boolean)
|
|
bsw/jbe@19
|
3
|
|
bsw/jbe@19
|
4 local head_name = "initiative_head_" .. tostring(initiative.id)
|
|
bsw/jbe@19
|
5 local link_name = "initiative_link_" .. tostring(initiative.id)
|
|
bsw/jbe@19
|
6 local name = "initiative_content_" .. tostring(initiative.id)
|
|
bsw/jbe@19
|
7 local icon_name = "initiative_icon_" .. tostring(initiative.id)
|
|
bsw/jbe@19
|
8
|
|
bsw/jbe@19
|
9 ui.container{
|
|
bsw/jbe@19
|
10 attr = { class = "ui_tabs" .. (initiative.id == for_initiative_id and " active" or "") },
|
|
bsw/jbe@19
|
11 content = function()
|
|
bsw/jbe@19
|
12 local module = "initiative"
|
|
bsw/jbe@19
|
13 local view = "show"
|
|
bsw/jbe@19
|
14 local id = initiative.id
|
|
bsw/jbe@19
|
15 local params = {}
|
|
bsw/jbe@19
|
16 ui.container{
|
|
bsw/jbe@19
|
17 attr = {
|
|
bsw/jbe@19
|
18 name = name,
|
|
bsw/jbe@19
|
19 class = "ui_tabs_accordeon_head",
|
|
bsw/jbe@19
|
20 id = head_name,
|
|
bsw/jbe@19
|
21 },
|
|
bsw/jbe@19
|
22 content = function()
|
|
bsw/jbe@19
|
23
|
|
bsw@29
|
24 ui.list{
|
|
bsw@29
|
25 attr = { class = "nohover" },
|
|
bsw@29
|
26 records = { { a = 1} },
|
|
bsw@29
|
27 columns = {
|
|
bsw@29
|
28 {
|
|
bsw@273
|
29 field_attr = { style = "width: 3em; padding: 0; text-align: center;"},
|
|
bsw@29
|
30 content = function()
|
|
bsw@29
|
31 if initiative.issue.accepted and initiative.issue.closed and initiative.issue.ranks_available or initiative.admitted == false then
|
|
bsw@29
|
32 ui.field.rank{ image_attr = { id = icon_name }, attr = { class = "rank" }, value = initiative.rank }
|
|
bsw@29
|
33 else
|
|
bsw@29
|
34 slot.put(" ")
|
|
bsw@29
|
35 end
|
|
bsw@29
|
36 end
|
|
bsw@29
|
37 },
|
|
bsw/jbe@19
|
38
|
|
bsw@29
|
39 {
|
|
bsw@29
|
40 field_attr = { style = "width: 110px; padding: 0;"},
|
|
bsw@29
|
41 content = function()
|
|
bsw/jbe@48
|
42 if initiative.issue.fully_frozen and initiative.issue.closed then
|
|
bsw@29
|
43 if initiative.issue.ranks_available then
|
|
bsw@29
|
44 if initiative.negative_votes and initiative.positive_votes then
|
|
bsw@29
|
45 local max_value = initiative.issue.voter_count
|
|
bsw@29
|
46 ui.bargraph{
|
|
bsw@29
|
47 max_value = max_value,
|
|
bsw@29
|
48 width = 100,
|
|
bsw@29
|
49 bars = {
|
|
bsw@29
|
50 { color = "#0a0", value = initiative.positive_votes },
|
|
bsw@29
|
51 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
|
|
bsw@29
|
52 { color = "#a00", value = initiative.negative_votes },
|
|
bsw@29
|
53 }
|
|
bsw@29
|
54 }
|
|
bsw@29
|
55 else
|
|
bsw@29
|
56 slot.put(" ")
|
|
bsw@29
|
57 end
|
|
bsw@29
|
58 else
|
|
bsw@29
|
59 slot.put(_"Counting of votes")
|
|
bsw@29
|
60 end
|
|
bsw@273
|
61 else
|
|
bsw@273
|
62 local max_value = initiative.issue.population or 0
|
|
bsw/jbe@19
|
63 ui.bargraph{
|
|
bsw/jbe@19
|
64 max_value = max_value,
|
|
bsw/jbe@19
|
65 width = 100,
|
|
poelzi@159
|
66 quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
|
|
poelzi@159
|
67 quorum_color = "#00F",
|
|
bsw/jbe@19
|
68 bars = {
|
|
bsw@29
|
69 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
|
|
bsw@29
|
70 { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
|
|
bsw@29
|
71 { color = "#eee", value = max_value - (initiative.supporter_count or 0) },
|
|
bsw/jbe@19
|
72 }
|
|
bsw/jbe@19
|
73 }
|
|
bsw/jbe@19
|
74 end
|
|
bsw/jbe@19
|
75 end
|
|
bsw@29
|
76 },
|
|
bsw@29
|
77
|
|
bsw@29
|
78 {
|
|
bsw@29
|
79 field_attr = { style = "padding: 0;"},
|
|
bsw/jbe@19
|
80 content = function()
|
|
bsw@274
|
81 local link_class = "initiative_link"
|
|
bsw@29
|
82 if initiative.revoked then
|
|
bsw@29
|
83 link_class = "revoked"
|
|
bsw/jbe@19
|
84 end
|
|
bsw@274
|
85 if selected then
|
|
bsw@274
|
86 link_class = link_class .. " selected"
|
|
bsw@274
|
87 end
|
|
bsw@274
|
88 if initiative.is_supporter then
|
|
bsw@274
|
89 link_class = link_class .. " supported"
|
|
bsw@274
|
90 end
|
|
bsw@274
|
91 if initiative.is_potential_supporter then
|
|
bsw@274
|
92 link_class = link_class .. " potentially_supported"
|
|
bsw@274
|
93 end
|
|
bsw@29
|
94 ui.link{
|
|
bsw@29
|
95 attr = { id = link_name, class = link_class },
|
|
bsw@29
|
96 content = function()
|
|
bsw@29
|
97 local name
|
|
bsw@29
|
98 if initiative.name_highlighted then
|
|
bsw@29
|
99 name = encode.highlight(initiative.name_highlighted)
|
|
bsw@29
|
100 else
|
|
bsw@29
|
101 name = encode.html(initiative.shortened_name)
|
|
bsw@29
|
102 end
|
|
bsw@274
|
103 ui.tag{ content = "i" .. initiative.id .. ": " }
|
|
bsw@29
|
104 slot.put(name)
|
|
bsw@29
|
105 end,
|
|
bsw@29
|
106 module = module,
|
|
bsw@29
|
107 view = view,
|
|
bsw@29
|
108 id = id,
|
|
bsw@29
|
109 params = params,
|
|
bsw@29
|
110 }
|
|
bsw@29
|
111
|
|
bsw@29
|
112 if initiative.is_initiator then
|
|
bsw@29
|
113 slot.put(" ")
|
|
mail@239
|
114 local label = _"You are initiator of this initiative"
|
|
bsw@29
|
115 ui.image{
|
|
bsw@29
|
116 attr = { alt = label, title = label },
|
|
bsw@29
|
117 static = "icons/16/user_edit.png"
|
|
bsw@29
|
118 }
|
|
bsw@29
|
119 end
|
|
bsw@29
|
120
|
|
bsw@29
|
121 end
|
|
bsw/jbe@19
|
122 }
|
|
bsw/jbe@19
|
123 }
|
|
bsw@29
|
124 }
|
|
bsw/jbe@19
|
125 end
|
|
bsw/jbe@19
|
126 }
|
|
bsw/jbe@19
|
127 end
|
|
bsw/jbe@19
|
128 }
|
|
bsw/jbe@19
|
129
|
|
bsw/jbe@19
|
130 if ui.is_partial_loading_enabled() then
|
|
bsw/jbe@19
|
131 ui.container{
|
|
bsw/jbe@19
|
132 attr = {
|
|
bsw/jbe@19
|
133 id = name,
|
|
bsw/jbe@19
|
134 class = "ui_tabs_accordeon_content",
|
|
bsw/jbe@19
|
135 },
|
|
bsw/jbe@19
|
136 content = function()
|
|
bsw/jbe@19
|
137 ui.container{
|
|
bsw/jbe@19
|
138 attr = { id = name .. "_content", style = "clear: left;" },
|
|
bsw/jbe@19
|
139 content = function()
|
|
bsw/jbe@19
|
140 execute.view{
|
|
bsw/jbe@19
|
141 module = "initiative",
|
|
bsw/jbe@19
|
142 view = "show_partial",
|
|
bsw/jbe@19
|
143 params = {
|
|
bsw/jbe@19
|
144 initiative = initiative,
|
|
bsw/jbe@19
|
145 }
|
|
bsw/jbe@19
|
146 }
|
|
bsw/jbe@19
|
147 end
|
|
bsw/jbe@19
|
148 }
|
|
bsw/jbe@19
|
149 end
|
|
bsw/jbe@19
|
150 }
|
|
bsw/jbe@19
|
151 end |