| rev |
line source |
|
bsw/jbe@0
|
1
|
|
bsw/jbe@0
|
2 slot.select("support", function()
|
|
bsw/jbe@0
|
3 local initiative = param.get("initiative", "table")
|
|
bsw/jbe@5
|
4 local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
|
|
bsw/jbe@0
|
5
|
|
bsw@10
|
6 if not initiative.issue.fully_frozen and not initiative.issue.closed then
|
|
bsw@10
|
7 if supporter then
|
|
bsw@10
|
8 if not supporter:has_critical_opinion() then
|
|
bsw@10
|
9 ui.container{
|
|
bsw@10
|
10 attr = {
|
|
bsw@10
|
11 class = "head head_supporter",
|
|
bsw@10
|
12 style = "cursor: pointer;",
|
|
bsw@10
|
13 onclick = "document.getElementById('support_content').style.display = 'block';"
|
|
bsw@10
|
14 },
|
|
bsw@10
|
15 content = function()
|
|
bsw@10
|
16 ui.image{
|
|
bsw@10
|
17 static = "icons/16/thumb_up_green.png"
|
|
bsw@10
|
18 }
|
|
bsw@10
|
19 slot.put(_"Your are supporter")
|
|
bsw@10
|
20 ui.image{
|
|
bsw@10
|
21 static = "icons/16/dropdown.png"
|
|
bsw/jbe@5
|
22 }
|
|
bsw@10
|
23 end
|
|
bsw@10
|
24 }
|
|
bsw@10
|
25 else
|
|
bsw@10
|
26 ui.container{
|
|
bsw@10
|
27 attr = {
|
|
bsw@10
|
28 class = "head head_potential_supporter",
|
|
bsw@10
|
29 style = "cursor: pointer;",
|
|
bsw@10
|
30 onclick = "document.getElementById('support_content').style.display = 'block';"
|
|
bsw@10
|
31 },
|
|
bsw@10
|
32 content = function()
|
|
bsw@10
|
33 ui.image{
|
|
bsw@10
|
34 static = "icons/16/thumb_up.png"
|
|
bsw@10
|
35 }
|
|
bsw@10
|
36 slot.put(_"Your are potential supporter")
|
|
bsw@10
|
37 ui.image{
|
|
bsw@10
|
38 static = "icons/16/dropdown.png"
|
|
bsw/jbe@5
|
39 }
|
|
bsw/jbe@5
|
40 end
|
|
bsw@10
|
41 }
|
|
bsw@10
|
42 end
|
|
bsw@10
|
43 ui.container{
|
|
bsw@10
|
44 attr = { class = "content", id = "support_content" },
|
|
bsw@10
|
45 content = function()
|
|
bsw/jbe@4
|
46 ui.container{
|
|
bsw@10
|
47 attr = {
|
|
bsw@10
|
48 class = "close",
|
|
bsw@10
|
49 style = "cursor: pointer;",
|
|
bsw@10
|
50 onclick = "document.getElementById('support_content').style.display = 'none';"
|
|
bsw@10
|
51 },
|
|
bsw/jbe@0
|
52 content = function()
|
|
bsw@10
|
53 ui.image{ static = "icons/16/cross.png" }
|
|
bsw/jbe@4
|
54 end
|
|
bsw/jbe@0
|
55 }
|
|
bsw@10
|
56 if supporter then
|
|
bsw@10
|
57 ui.link{
|
|
bsw@10
|
58 content = function()
|
|
bsw@10
|
59 ui.image{ static = "icons/16/thumb_down_red.png" }
|
|
bsw@10
|
60 slot.put(_"Remove my support from this initiative")
|
|
bsw@10
|
61 end,
|
|
bsw@10
|
62 module = "initiative",
|
|
bsw@10
|
63 action = "remove_support",
|
|
bsw@10
|
64 id = initiative.id,
|
|
bsw@10
|
65 routing = {
|
|
bsw@10
|
66 default = {
|
|
bsw@10
|
67 mode = "redirect",
|
|
bsw@10
|
68 module = request.get_module(),
|
|
bsw@10
|
69 view = request.get_view(),
|
|
bsw@10
|
70 id = param.get_id_cgi(),
|
|
bsw@10
|
71 params = param.get_all_cgi()
|
|
bsw@10
|
72 }
|
|
bsw/jbe@4
|
73 }
|
|
bsw/jbe@4
|
74 }
|
|
bsw@10
|
75 else
|
|
bsw@10
|
76 end
|
|
bsw@10
|
77 end
|
|
bsw@10
|
78 }
|
|
bsw@10
|
79 else
|
|
bsw@10
|
80 if not initiative.revoked then
|
|
bsw@10
|
81 ui.link{
|
|
bsw@10
|
82 content = function()
|
|
bsw@10
|
83 ui.image{ static = "icons/16/thumb_up_green.png" }
|
|
bsw@10
|
84 slot.put(_"Support this initiative")
|
|
bsw@10
|
85 end,
|
|
bsw@10
|
86 module = "initiative",
|
|
bsw@10
|
87 action = "add_support",
|
|
bsw@10
|
88 id = initiative.id,
|
|
bsw@10
|
89 routing = {
|
|
bsw@10
|
90 default = {
|
|
bsw@10
|
91 mode = "redirect",
|
|
bsw@10
|
92 module = request.get_module(),
|
|
bsw@10
|
93 view = request.get_view(),
|
|
bsw@10
|
94 id = param.get_id_cgi(),
|
|
bsw@10
|
95 params = param.get_all_cgi()
|
|
bsw@10
|
96 }
|
|
bsw/jbe@0
|
97 }
|
|
bsw@10
|
98 }
|
|
bsw/jbe@0
|
99 end
|
|
bsw/jbe@4
|
100 end
|
|
bsw@10
|
101 end
|
|
bsw@10
|
102
|
|
bsw/jbe@0
|
103 end)
|