liquid_feedback_frontend
view app/main/area/_sidebar_whatcanido.lua @ 1273:0fda5edca3af
Fixes on notification system
author | bsw |
---|---|
date | Sun Apr 17 17:24:21 2016 +0200 (2016-04-17) |
parents | 84f6e17c7ceb |
children | 32cc544d5a5b |
line source
1 local member = param.get ( "member", "table" ) or app.session.member
3 local area = param.get ( "area", "table" )
5 local participating_trustee_id
6 local participating_trustee_name
7 if member then
8 if area.delegation_info.first_trustee_participation then
9 participating_trustee_id = area.delegation_info.first_trustee_id
10 participating_trustee_name = area.delegation_info.first_trustee_name
11 elseif area.delegation_info.other_trustee_participation then
12 participating_trustee_id = area.delegation_info.other_trustee_id
13 participating_trustee_name = area.delegation_info.other_trustee_name
14 end
15 end
17 ui.sidebar ( "tab-whatcanido", function ()
19 ui.sidebarHeadWhatCanIDo()
21 if member and not app.session.member:has_voting_right_for_unit_id(area.unit_id) then
22 ui.sidebarSection( _"You are not entitled to vote in this unit" )
23 end
25 if member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
27 if not app.session.member.disable_notifications then
29 local ignored_area = IgnoredArea:by_pk(app.session.member_id, area.id)
31 if not ignored_area then
32 ui.sidebarSection ( function ()
34 ui.heading {
35 level = 3,
36 content = _"You are receiving updates by email for this subject area"
37 }
38 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
39 ui.tag { tag = "li", content = function ()
40 ui.tag { content = function ()
41 ui.link {
42 module = "area", action = "update_ignore",
43 params = { area_id = area.id },
44 routing = { default = {
45 mode = "redirect", module = "area", view = "show", id = area.id
46 } },
47 text = _"unsubscribe from update emails about this area"
48 }
49 end }
50 end }
51 end }
52 end )
53 end
55 if ignored_area then
56 ui.sidebarSection ( function ()
58 ui.heading {
59 level = 3,
60 content = _"I want to stay informed"
61 }
62 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
63 ui.tag { tag = "li", content = function ()
64 ui.tag { content = function ()
65 ui.link {
66 module = "area", action = "update_ignore",
67 params = { area_id = area.id, delete = true },
68 routing = { default = {
69 mode = "redirect", module = "area", view = "show", id = area.id
70 } },
71 text = _"subscribe for update emails about this area"
72 }
73 end }
74 end }
75 end }
76 end )
77 end
79 else
80 ui.sidebarSection ( function ()
82 ui.heading {
83 level = 3,
84 content = _"I want to stay informed about this subject area"
85 }
86 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
87 ui.tag { tag = "li", content = function ()
88 ui.tag { content = function ()
89 ui.tag{ content = _"Edit your global " }
90 ui.link {
91 module = "member", view = "settings_notification",
92 params = { return_to = "area", return_to_area_id = area.id },
93 text = _"notification settings"
94 }
95 ui.tag{ content = _" to receive updates by email" }
96 end }
97 end }
98 end }
99 end )
100 end
102 if area.delegation_info.own_participation then
103 ui.sidebarSection ( function ()
104 ui.image{ attr = { class = "right" }, static = "icons/48/star.png" }
105 ui.heading {
106 level = 3,
107 content = _"You are subscribed for this subject area"
108 }
109 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
110 ui.tag { tag = "li", content = function ()
111 ui.tag { content = function ()
112 ui.link {
113 module = "membership", action = "update",
114 routing = { default = {
115 mode = "redirect", module = "area", view = "show", id = area.id
116 } },
117 params = { area_id = area.id, delete = true },
118 text = _"unsubscribe"
119 }
120 end }
121 end }
122 end }
123 end )
124 end
126 if not area.delegation_info.own_participation then
127 ui.sidebarSection ( function ()
129 ui.heading {
130 level = 3,
131 content = _"I want to participate in this subject area"
132 }
133 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
134 ui.tag { tag = "li", content = function ()
135 ui.tag { content = function ()
136 ui.link {
137 module = "membership", action = "update",
138 routing = { default = {
139 mode = "redirect", module = "area", view = "show", id = area.id
140 } },
141 params = { area_id = area.id },
142 text = _"subscribe"
143 }
144 end }
145 end }
146 end }
147 end )
148 end
152 ui.sidebarSection ( function ()
155 if not area.delegation_info.first_trustee_id then
156 ui.heading{ level = 3, content = _"I want to delegate this subject area" }
157 else
158 ui.container { attr = { class = "right" }, content = function()
159 local member = Member:by_id(area.delegation_info.first_trustee_id)
160 execute.view{
161 module = "member_image",
162 view = "_show",
163 params = {
164 member = member,
165 image_type = "avatar",
166 show_dummy = true
167 }
168 }
169 end }
170 ui.heading{ level = 3, content = _"You delegated this subject area" }
171 end
173 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
174 if area.delegation_info.own_delegation_scope == "unit" then
175 ui.tag { tag = "li", content = function ()
176 ui.link {
177 module = "delegation", view = "show", params = {
178 unit_id = area.unit_id,
179 },
180 content = _("change/revoke delegation of organizational unit")
181 }
182 end }
183 end
185 if area.delegation_info.own_delegation_scope == nil then
186 ui.tag { tag = "li", content = function ()
187 ui.link {
188 module = "delegation", view = "show", params = {
189 area_id = area.id
190 },
191 content = _"choose subject area delegatee"
192 }
193 end }
194 elseif area.delegation_info.own_delegation_scope == "area" then
195 ui.tag { tag = "li", content = function ()
196 ui.link {
197 module = "delegation", view = "show", params = {
198 area_id = area.id
199 },
200 content = _"change/revoke area delegation"
201 }
202 end }
203 else
204 ui.tag { tag = "li", content = function ()
205 ui.link {
206 module = "delegation", view = "show", params = {
207 area_id = area.id
208 },
209 content = _"change/revoke delegation only for this subject area"
210 }
211 end }
212 end
213 end }
214 end )
219 if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then
220 ui.sidebarSection ( function ()
221 ui.heading {
222 level = 3,
223 content = _("I want to start a new initiative", {
224 area_name = area.name
225 } )
226 }
227 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
228 ui.tag { tag = "li", content = _"Take a look through the existing issues. Maybe someone else started a debate on your topic (and you can join it) or the topic has been decided already in the past." }
229 ui.tag { tag = "li", content = function ()
230 ui.tag { content = function ()
231 ui.tag { content = _"If you cannot find any appropriate existing issue, " }
232 ui.link {
233 module = "initiative", view = "new",
234 params = { area_id = area.id },
235 text = _"start an initiative in a new issue"
236 }
237 end }
238 end }
239 end }
240 end )
241 end
242 else
243 end
245 end )