liquid_feedback_frontend

view app/main/supporter/_show_box.lua @ 720:cdd0bcbbef8b

Improved paginators on initiative view, optical improvements
author bsw
date Wed Jun 27 19:28:39 2012 +0200 (2012-06-27)
parents 5ca9de94cb13
children b1ba5d237b6d
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 local initiative = param.get("initiative", "table")
7 local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
9 local partial = {
10 routing = {
11 default = {
12 mode = "redirect",
13 module = "initiative",
14 view = "show_support",
15 id = initiative.id
16 }
17 }
18 }
20 local routing = {
21 default = {
22 mode = "redirect",
23 module = request.get_module(),
24 view = request.get_view(),
25 id = param.get_id_cgi(),
26 params = param.get_all_cgi()
27 }
28 }
30 if not initiative.issue.fully_frozen and not initiative.issue.closed then
31 if supporter then
32 if not supporter:has_critical_opinion() then
33 ui.tag{ content = function()
34 ui.image{
35 static = "icons/16/thumb_up_green.png"
36 }
37 if initiative.issue.closed then
38 slot.put(_"You were supporter")
39 else
40 slot.put(_"You are supporter")
41 end
42 end }
43 else
44 ui.tag{ attr = { class = "potential_supporter" }, content = function()
45 ui.image{
46 static = "icons/16/thumb_up.png"
47 }
48 if initiative.issue.closed then
49 slot.put(_"You were potential supporter")
50 else
51 slot.put(_"You are potential supporter")
52 end
53 end }
54 end
55 slot.put(" (")
56 ui.link{
57 text = _"Withdraw",
58 module = "initiative",
59 action = "remove_support",
60 id = initiative.id,
61 routing = routing,
62 partial = partial
63 }
64 slot.put(") ")
65 elseif not initiative.revoked and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) then
66 local params = param.get_all_cgi()
67 params.dyn = nil
68 ui.link{
69 text = _"Support this initiative",
70 module = "initiative",
71 action = "add_support",
72 id = initiative.id,
73 routing = routing,
74 partial = partial
75 }
76 slot.put(" ")
77 end
78 end
80 if (initiative.discussion_url and #initiative.discussion_url > 0) then
81 if initiative.discussion_url:find("^https?://") then
82 if initiative.discussion_url and #initiative.discussion_url > 0 then
83 ui.link{
84 attr = {
85 target = "_blank",
86 title = _"Discussion with initiators"
87 },
88 text = _"Discuss with initiators",
89 external = initiative.discussion_url
90 }
91 slot.put(" ")
92 end
93 else
94 slot.put(encode.html(initiative.discussion_url))
95 end
96 end
97 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
98 ui.link{
99 image = { static = "icons/16/comments.png" },
100 text = _"change discussion URL",
101 module = "initiative",
102 view = "edit",
103 id = initiative.id
104 }
105 slot.put(" ")
106 end
107 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
108 ui.link{
109 content = function()
110 ui.image{ static = "icons/16/script_add.png" }
111 slot.put(_"Edit draft")
112 end,
113 module = "draft",
114 view = "new",
115 params = { initiative_id = initiative.id }
116 }
117 slot.put(" ")
118 end
120 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
121 ui.link{
122 content = function()
123 ui.image{ static = "icons/16/script_delete.png" }
124 slot.put(_"Revoke initiative")
125 end,
126 module = "initiative",
127 view = "revoke",
128 id = initiative.id
129 }
130 slot.put(" ")
131 end
133 if not initiative.issue.closed then
134 local ignored_initiative = IgnoredInitiative:by_pk(app.session.member.id, initiative.id)
135 if ignored_initiative then
136 ui.tag{
137 content = _"You have ignored this initiative"
138 }
139 ui.link{
140 text = _"Stop ignoring initiative",
141 module = "initiative",
142 action = "update_ignore",
143 id = initiative.id,
144 params = { delete = true },
145 routing = {
146 default = {
147 mode = "redirect",
148 module = request.get_module(),
149 view = request.get_view(),
150 id = param.get_id_cgi(),
151 params = param.get_all_cgi()
152 }
153 }
154 }
155 else
156 ui.link{
157 text = _"Ignore initiative",
158 module = "initiative",
159 action = "update_ignore",
160 id = initiative.id,
161 routing = {
162 default = {
163 mode = "redirect",
164 module = request.get_module(),
165 view = request.get_view(),
166 id = param.get_id_cgi(),
167 params = param.get_all_cgi()
168 }
169 }
170 }
171 end
172 end

Impressum / About Us