rev |
line source |
bsw@1045
|
1 local return_to = param.get("return_to")
|
bsw@1250
|
2 local return_to_area_id param.get("return_to_area_id", atom.integer)
|
bsw@1045
|
3
|
bsw@1126
|
4 ui.titleMember(_"notification settings")
|
bsw@286
|
5
|
bsw@1045
|
6 execute.view {
|
bsw@1045
|
7 module = "member", view = "_sidebar_whatcanido", params = {
|
bsw@1045
|
8 member = app.session.member
|
bsw@1045
|
9 }
|
bsw@1045
|
10 }
|
bsw@286
|
11
|
bsw@286
|
12 ui.form{
|
bsw@286
|
13 attr = { class = "vertical" },
|
bsw@286
|
14 module = "member",
|
bsw@348
|
15 action = "update_notify_level",
|
bsw@286
|
16 routing = {
|
bsw@286
|
17 ok = {
|
bsw@286
|
18 mode = "redirect",
|
bsw@1250
|
19 module = return_to == "area" and "area" or return_to == "home" and "index" or "member",
|
bsw@1250
|
20 view = return_to == "area" and "show" or return_to == "home" and "index" or "show",
|
bsw@1250
|
21 id = return_to == "area" and return_to_area_id or return_to ~= "home" and app.session.member_id or nil
|
bsw@286
|
22 }
|
bsw@286
|
23 },
|
bsw@286
|
24 content = function()
|
bsw@1045
|
25
|
bsw@1045
|
26 ui.section( function()
|
bsw@1045
|
27
|
bsw@1045
|
28 ui.sectionHead( function()
|
bsw@1250
|
29 ui.heading { level = 1, content = _"Do you like to receive updates by email?" }
|
bsw@1045
|
30 end )
|
bsw@1045
|
31
|
bsw@474
|
32
|
bsw@1045
|
33 ui.sectionRow( function()
|
bsw@1045
|
34
|
bsw@1045
|
35 ui.container{ content = function()
|
bsw@1045
|
36 ui.tag{
|
bsw@1045
|
37 tag = "input",
|
bsw@1045
|
38 attr = {
|
bsw@1045
|
39 id = "notify_level_all",
|
bsw@1248
|
40 type = "radio", name = "disable_notifications", value = "false",
|
bsw@1248
|
41 checked = not app.session.member.disable_notifications and "checked" or nil
|
bsw@1045
|
42 }
|
bsw@1045
|
43 }
|
bsw@1045
|
44 ui.tag{
|
bsw@1045
|
45 tag = "label", attr = { ['for'] = "notify_level_all" },
|
bsw@1045
|
46 content = _"I like to receive notifications"
|
bsw@1045
|
47 }
|
bsw@1045
|
48 end }
|
bsw@1045
|
49
|
bsw@1045
|
50 slot.put("<br />")
|
bsw@1255
|
51
|
bsw@1261
|
52 ui.container{ attr = { style = "margin-left: 3em;" }, content = function()
|
bsw@1277
|
53
|
bsw@1277
|
54 ui.container{ content = _"You will receive status update notification on issue phase changes. Additionally you can subscribe for a regular digest including updates on initiative drafts and new suggestions." }
|
bsw@1255
|
55
|
bsw@1261
|
56 ui.container{ content = function()
|
bsw@1261
|
57 ui.tag{
|
bsw@1261
|
58 tag = "input",
|
bsw@1261
|
59 attr = {
|
bsw@1261
|
60 id = "digest_on",
|
bsw@1261
|
61 type = "radio", name = "digest", value = "true",
|
bsw@1266
|
62 checked = app.session.member.notification_hour ~= nil and "checked" or nil
|
bsw@1261
|
63 }
|
bsw@1261
|
64 }
|
bsw@1261
|
65 ui.tag{
|
bsw@1261
|
66 tag = "label", attr = { ['for'] = "digest_on" },
|
bsw@1277
|
67 content = _"I want to receive a regular digest. Send the digest at:"
|
bsw@1261
|
68 }
|
bsw@1262
|
69 end }
|
bsw@1261
|
70
|
bsw@1266
|
71 ui.container{ attr = { style = "margin-left: 4em;" }, content = function()
|
bsw@1261
|
72 ui.tag{ content = _"Day:" }
|
bsw@1261
|
73 slot.put(" ")
|
bsw@1261
|
74 ui.field.select{
|
bsw@1273
|
75 container_attr = { style = "display: inline-block; vertical-align: middle;" },
|
bsw@1274
|
76 attr = { style = "width: 10em;" },
|
bsw@1261
|
77 name = "notification_dow",
|
bsw@1261
|
78 foreign_records = {
|
bsw@1261
|
79 { id = "daily", name = _"daily" },
|
bsw@1271
|
80 { id = 0, name = _"Sunday" },
|
bsw@1271
|
81 { id = 1, name = _"Monday" },
|
bsw@1271
|
82 { id = 2, name = _"Tuesday" },
|
bsw@1271
|
83 { id = 3, name = _"Wednesday" },
|
bsw@1271
|
84 { id = 4, name = _"Thursday" },
|
bsw@1271
|
85 { id = 5, name = _"Friday" },
|
bsw@1271
|
86 { id = 6, name = _"Saturday" }
|
bsw@1261
|
87 },
|
bsw@1261
|
88 foreign_id = "id",
|
bsw@1272
|
89 foreign_name = "name",
|
bsw@1272
|
90 value = app.session.member.notification_dow
|
bsw@1255
|
91 }
|
bsw@1261
|
92
|
bsw@1261
|
93 slot.put(" ")
|
bsw@1261
|
94
|
bsw@1261
|
95 ui.tag{ content = _"Hour:" }
|
bsw@1261
|
96 slot.put(" ")
|
bsw@1261
|
97 local foreign_records = {}
|
bsw@1261
|
98 for i = 0, 23 do
|
bsw@1261
|
99 foreign_records[#foreign_records+1] = {
|
bsw@1261
|
100 id = i,
|
bsw@1277
|
101 name = string.format("%02d:00 - %02d:59", i, i),
|
bsw@1261
|
102 }
|
bsw@1261
|
103 end
|
bsw@1261
|
104 ui.field.select{
|
bsw@1273
|
105 container_attr = { style = "display: inline-block; vertical-align: middle;" },
|
bsw@1274
|
106 attr = { style = "width: 6em;" },
|
bsw@1261
|
107 name = "notification_hour",
|
bsw@1261
|
108 foreign_records = foreign_records,
|
bsw@1261
|
109 foreign_id = "id",
|
bsw@1268
|
110 foreign_name = "name",
|
bsw@1272
|
111 value = app.session.member.notification_hour
|
bsw@1261
|
112 }
|
bsw@1261
|
113 end }
|
bsw@1261
|
114
|
bsw@1261
|
115 ui.container{ content = function()
|
bsw@1261
|
116 ui.tag{
|
bsw@1261
|
117 tag = "input",
|
bsw@1261
|
118 attr = {
|
bsw@1261
|
119 id = "digest_off",
|
bsw@1261
|
120 type = "radio", name = "digest", value = "false",
|
bsw@1276
|
121 checked = app.session.member.notification_dow == nil and app.session.member.notification_hour == nil and "checked" or nil
|
bsw@1261
|
122 }
|
bsw@1261
|
123 }
|
bsw@1261
|
124 ui.tag{
|
bsw@1261
|
125 tag = "label", attr = { ['for'] = "digest_off" },
|
bsw@1277
|
126 content = _"Don't send me digest"
|
bsw@1261
|
127 }
|
bsw@1261
|
128 end }
|
bsw@1255
|
129 end }
|
bsw@1255
|
130
|
bsw@1263
|
131 slot.put("<br />")
|
bsw@1255
|
132
|
bsw@1045
|
133 ui.container{ content = function()
|
bsw@1045
|
134 ui.tag{
|
bsw@1045
|
135 tag = "input",
|
bsw@1045
|
136 attr = {
|
bsw@1045
|
137 id = "notify_level_none",
|
bsw@1248
|
138 type = "radio", name = "disable_notifications", value = "true",
|
bsw@1248
|
139 checked = app.session.member.disable_notifications and "checked" or nil
|
bsw@1045
|
140 }
|
bsw@1045
|
141 }
|
bsw@1045
|
142 ui.tag{
|
bsw@1045
|
143 tag = "label", attr = { ['for'] = "notify_level_none" },
|
bsw@1277
|
144 content = _"Don't send me notification by email"
|
bsw@1045
|
145 }
|
bsw@1045
|
146 end }
|
bsw@1045
|
147
|
bsw@1045
|
148 slot.put("<br />")
|
bsw@1045
|
149
|
bsw@1045
|
150 ui.tag{
|
bsw@1045
|
151 tag = "input",
|
bsw@1045
|
152 attr = {
|
bsw@1045
|
153 type = "submit",
|
bsw@1045
|
154 class = "btn btn-default",
|
bsw@1045
|
155 value = _"Save"
|
bsw@1045
|
156 },
|
bsw@1045
|
157 content = ""
|
bsw@348
|
158 }
|
bsw@1045
|
159 slot.put("<br /><br /><br />")
|
bsw@1045
|
160
|
bsw@1045
|
161 slot.put(" ")
|
bsw@1045
|
162 if return_to == "home" then
|
bsw@1045
|
163 ui.link {
|
bsw@1045
|
164 module = "index", view = "index",
|
bsw@1045
|
165 content = _"cancel"
|
bsw@1045
|
166 }
|
bsw@1045
|
167 else
|
bsw@1045
|
168 ui.link {
|
bsw@1045
|
169 module = "member", view = "show", id = app.session.member_id,
|
bsw@1045
|
170 content = _"cancel"
|
bsw@1045
|
171 }
|
bsw@1045
|
172 end
|
bsw@1045
|
173 end )
|
bsw@1045
|
174 end )
|
bsw@474
|
175
|
bsw@286
|
176 end
|
bsw@286
|
177 }
|
bsw@287
|
178
|