liquid_feedback_frontend

view app/main/supporter/_show_box.lua @ 722:b1ba5d237b6d

Optical improvements
author bsw
date Wed Jun 27 22:19:49 2012 +0200 (2012-06-27)
parents cdd0bcbbef8b
children 344e5fdce8c9
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 text = _"change discussion URL",
100 module = "initiative",
101 view = "edit",
102 id = initiative.id
103 }
104 slot.put(" ")
105 end
106 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
107 ui.link{
108 content = function()
109 slot.put(_"Edit draft")
110 end,
111 module = "draft",
112 view = "new",
113 params = { initiative_id = initiative.id }
114 }
115 slot.put(" ")
116 end
118 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
119 ui.link{
120 content = function()
121 slot.put(_"Revoke initiative")
122 end,
123 module = "initiative",
124 view = "revoke",
125 id = initiative.id
126 }
127 slot.put(" ")
128 end
130 if not initiative.issue.closed then
131 local ignored_initiative = IgnoredInitiative:by_pk(app.session.member.id, initiative.id)
132 if ignored_initiative then
133 ui.tag{
134 content = _"You have ignored this initiative"
135 }
136 ui.link{
137 text = _"Stop ignoring initiative",
138 module = "initiative",
139 action = "update_ignore",
140 id = initiative.id,
141 params = { delete = true },
142 routing = {
143 default = {
144 mode = "redirect",
145 module = request.get_module(),
146 view = request.get_view(),
147 id = param.get_id_cgi(),
148 params = param.get_all_cgi()
149 }
150 }
151 }
152 else
153 ui.link{
154 text = _"Ignore initiative",
155 module = "initiative",
156 action = "update_ignore",
157 id = initiative.id,
158 routing = {
159 default = {
160 mode = "redirect",
161 module = request.get_module(),
162 view = request.get_view(),
163 id = param.get_id_cgi(),
164 params = param.get_all_cgi()
165 }
166 }
167 }
168 end
169 end

Impressum / About Us