liquid_feedback_frontend
view app/main/supporter/_show_box.lua @ 434:5a4f5cc161d7
Put admin button to footer
author | bsw |
---|---|
date | Sun Mar 11 09:14:19 2012 +0100 (2012-03-11) |
parents | b77e6a17ca77 |
children | 955bd41e1559 |
line source
1 local initiative = param.get("initiative", "table") or Initiative:by_id(param.get_id())
3 -- TODO performance
4 local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
6 ui.partial{
7 module = "initiative",
8 view = "show_support",
9 id = initiative.id,
10 target = "initiative_" .. tostring(initiative.id) .. "_support",
11 content = function()
13 ui.container{
14 attr = { class = "actions" },
15 content = function()
17 local initiative = param.get("initiative", "table")
18 local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
20 local partial = {
21 routing = {
22 default = {
23 mode = "redirect",
24 module = "initiative",
25 view = "show_support",
26 id = initiative.id
27 }
28 }
29 }
31 local routing = {
32 default = {
33 mode = "redirect",
34 module = request.get_module(),
35 view = request.get_view(),
36 id = param.get_id_cgi(),
37 params = param.get_all_cgi()
38 }
39 }
41 if not initiative.issue.fully_frozen and not initiative.issue.closed then
42 if supporter then
43 if not supporter:has_critical_opinion() then
44 ui.container{ attr = { class = "supporter" }, content = function()
45 ui.image{
46 static = "icons/16/thumb_up_green.png"
47 }
48 slot.put(_"Your are supporter")
49 end }
50 else
51 ui.tag{ attr = { class = "potential_supporter" }, content = function()
52 ui.image{
53 static = "icons/16/thumb_up.png"
54 }
55 slot.put(_"Your are potential supporter")
56 end }
57 end
58 ui.link{
59 image = { static = "icons/16/cross.png" },
60 text = _"Withdraw support",
61 module = "initiative",
62 action = "remove_support",
63 id = initiative.id,
64 routing = routing,
65 partial = partial
66 }
67 elseif not initiative.revoked and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) then
68 local params = param.get_all_cgi()
69 params.dyn = nil
70 ui.link{
71 image = { static = "icons/16/thumb_up_green.png" },
72 text = _"Support this initiative",
73 module = "initiative",
74 action = "add_support",
75 id = initiative.id,
76 routing = routing,
77 partial = partial
78 }
79 end
80 end
83 if (initiative.discussion_url and #initiative.discussion_url > 0) then
84 if initiative.discussion_url:find("^https?://") then
85 if initiative.discussion_url and #initiative.discussion_url > 0 then
86 ui.link{
87 attr = {
88 target = "_blank",
89 title = _"Discussion with initiators"
90 },
91 image = { static = "icons/16/comments.png" },
92 text = _"Discuss with initiators",
93 external = initiative.discussion_url
94 }
95 end
96 else
97 slot.put(encode.html(initiative.discussion_url))
98 end
99 end
100 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
101 ui.link{
102 image = { static = "icons/16/comments.png" },
103 text = _"change discussion URL",
104 module = "initiative",
105 view = "edit",
106 id = initiative.id
107 }
108 end
109 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
110 ui.link{
111 content = function()
112 ui.image{ static = "icons/16/script_add.png" }
113 slot.put(_"Edit draft")
114 end,
115 module = "draft",
116 view = "new",
117 params = { initiative_id = initiative.id }
118 }
119 end
121 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
122 ui.link{
123 content = function()
124 ui.image{ static = "icons/16/script_delete.png" }
125 slot.put(_"Revoke initiative")
126 end,
127 module = "initiative",
128 view = "revoke",
129 id = initiative.id
130 }
131 end
132 end
133 }
136 slot.put("<div style='clear: left;'></div>")
137 end
138 }