liquid_feedback_frontend
view app/main/supporter/_show_box.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 | 034f96181e59 |
children | 1783a0c61734 |
line source
2 local initiative = param.get("initiative", "table")
3 local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
5 local unique_string = multirand.string(16, '0123456789abcdef')
8 local partial = {
9 routing = {
10 default = {
11 mode = "redirect",
12 module = "initiative",
13 view = "show_support",
14 id = initiative.id
15 }
16 }
17 }
19 local routing = {
20 default = {
21 mode = "redirect",
22 module = request.get_module(),
23 view = request.get_view(),
24 id = param.get_id_cgi(),
25 params = param.get_all_cgi()
26 }
27 }
29 if not initiative.issue.fully_frozen and not initiative.issue.closed then
30 if supporter then
31 if not supporter:has_critical_opinion() then
32 ui.container{
33 attr = {
34 class = "head head_supporter",
35 style = "cursor: pointer;",
36 onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'block';"
37 },
38 content = function()
39 ui.image{
40 static = "icons/16/thumb_up_green.png"
41 }
42 if supporter.auto_support then
43 slot.put(_"Your are supporter (Autosupport enabled)")
44 else
45 slot.put(_"Your are supporter")
46 end
47 ui.image{
48 static = "icons/16/dropdown.png"
49 }
50 end
51 }
52 else
53 ui.container{
54 attr = {
55 class = "head head_potential_supporter",
56 style = "cursor: pointer;",
57 onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'block';"
58 },
59 content = function()
60 ui.image{
61 static = "icons/16/thumb_up.png"
62 }
63 if supporter.auto_support then
64 slot.put(_"Your are potential supporter (WARNING: Autosupport enabled)")
65 else
66 slot.put(_"Your are potential supporter")
67 end
68 ui.image{
69 static = "icons/16/dropdown.png"
70 }
71 end
72 }
73 end
74 ui.container{
75 attr = { class = "content", id = "support_content_" .. unique_string .. "" },
76 content = function()
77 ui.container{
78 attr = {
79 class = "close",
80 style = "cursor: pointer;",
81 onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'none';"
82 },
83 content = function()
84 ui.image{ static = "icons/16/cross.png" }
85 end
86 }
87 if supporter then
88 if config.auto_support then
89 if supporter.auto_support then
90 ui.link{
91 image = { static = "icons/16/cancel.png" },
92 text = _"Disable autosupport for this initiative",
93 module = "initiative",
94 action = "add_support",
95 id = initiative.id,
96 routing = routing,
97 partial = partial,
98 params = { auto_support = false }
99 }
100 else
101 ui.link{
102 image = { static = "icons/16/tick.png" },
103 text = _"Enable autosupport for this initiative",
104 module = "initiative",
105 action = "add_support",
106 id = initiative.id,
107 routing = routing,
108 partial = partial,
109 params = { auto_support = true }
110 }
111 end
112 end
113 ui.link{
114 image = { static = "icons/16/thumb_down_red.png" },
115 text = _"Remove my support from this initiative",
116 module = "initiative",
117 action = "remove_support",
118 id = initiative.id,
119 routing = routing,
120 partial = partial
121 }
122 else
123 end
124 end
125 }
126 else
127 if not initiative.revoked then
128 local params = param.get_all_cgi()
129 params.dyn = nil
130 ui.link{
131 image = { static = "icons/16/thumb_up_green.png" },
132 text = _"Support this initiative",
133 module = "initiative",
134 action = "add_support",
135 id = initiative.id,
136 routing = routing,
137 partial = partial
138 }
139 end
140 end
141 end