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@1255
|
53
|
bsw@1261
|
54 ui.container{ content = function()
|
bsw@1261
|
55 ui.tag{
|
bsw@1261
|
56 tag = "input",
|
bsw@1261
|
57 attr = {
|
bsw@1261
|
58 id = "digest_on",
|
bsw@1261
|
59 type = "radio", name = "digest", value = "true",
|
bsw@1261
|
60 checked = not app.session.member.digest_dow and "checked" or nil
|
bsw@1261
|
61 }
|
bsw@1261
|
62 }
|
bsw@1261
|
63 ui.tag{
|
bsw@1261
|
64 tag = "label", attr = { ['for'] = "digest_on" },
|
bsw@1261
|
65 content = _"Send me updates on issue phase changes and a regular digest"
|
bsw@1261
|
66 }
|
bsw@1261
|
67
|
bsw@1261
|
68 ui.tag{ content = _"Day:" }
|
bsw@1261
|
69 slot.put(" ")
|
bsw@1261
|
70 ui.field.select{
|
bsw@1261
|
71 container_attr = { style = "display: inline-block; width: 10em; vertical-align: middle;" },
|
bsw@1261
|
72 name = "notification_dow",
|
bsw@1261
|
73 foreign_records = {
|
bsw@1261
|
74 { id = "daily", name = _"daily" },
|
bsw@1261
|
75 { id = "0", name = _"Sunday" },
|
bsw@1261
|
76 { id = "1", name = _"Monday" },
|
bsw@1261
|
77 { id = "2", name = _"Tuesday" },
|
bsw@1261
|
78 { id = "3", name = _"Wednesday" },
|
bsw@1261
|
79 { id = "4", name = _"Thursday" },
|
bsw@1261
|
80 { id = "5", name = _"Friday" },
|
bsw@1261
|
81 { id = "6", name = _"Saturday" }
|
bsw@1261
|
82 },
|
bsw@1261
|
83 foreign_id = "id",
|
bsw@1261
|
84 foreign_name = "name"
|
bsw@1255
|
85 }
|
bsw@1261
|
86
|
bsw@1261
|
87 slot.put(" ")
|
bsw@1261
|
88
|
bsw@1261
|
89 ui.tag{ content = _"Hour:" }
|
bsw@1261
|
90 slot.put(" ")
|
bsw@1261
|
91 local foreign_records = {}
|
bsw@1261
|
92 for i = 0, 23 do
|
bsw@1261
|
93 foreign_records[#foreign_records+1] = {
|
bsw@1261
|
94 id = i,
|
bsw@1261
|
95 name = string.format("%02d", i),
|
bsw@1261
|
96 }
|
bsw@1261
|
97 end
|
bsw@1261
|
98 ui.field.select{
|
bsw@1261
|
99 container_attr = { style = "display: inline-block; width: 3em; vertical-align: middle;" },
|
bsw@1261
|
100 name = "notification_hour",
|
bsw@1261
|
101 foreign_records = foreign_records,
|
bsw@1261
|
102 foreign_id = "id",
|
bsw@1261
|
103 foreign_name = "name"
|
bsw@1261
|
104 }
|
bsw@1261
|
105 end }
|
bsw@1261
|
106
|
bsw@1261
|
107 ui.container{ content = function()
|
bsw@1261
|
108 ui.tag{
|
bsw@1261
|
109 tag = "input",
|
bsw@1261
|
110 attr = {
|
bsw@1261
|
111 id = "digest_off",
|
bsw@1261
|
112 type = "radio", name = "digest", value = "false",
|
bsw@1261
|
113 checked = not app.session.member.digest_dow and "checked" or nil
|
bsw@1261
|
114 }
|
bsw@1261
|
115 }
|
bsw@1261
|
116 ui.tag{
|
bsw@1261
|
117 tag = "label", attr = { ['for'] = "digest_off" },
|
bsw@1261
|
118 content = _"Send me only updates on issue phase changes"
|
bsw@1261
|
119 }
|
bsw@1261
|
120 end }
|
bsw@1255
|
121 end }
|
bsw@1255
|
122
|
bsw@1255
|
123
|
bsw@1045
|
124 ui.container{ content = function()
|
bsw@1045
|
125 ui.tag{
|
bsw@1045
|
126 tag = "input",
|
bsw@1045
|
127 attr = {
|
bsw@1045
|
128 id = "notify_level_none",
|
bsw@1248
|
129 type = "radio", name = "disable_notifications", value = "true",
|
bsw@1248
|
130 checked = app.session.member.disable_notifications and "checked" or nil
|
bsw@1045
|
131 }
|
bsw@1045
|
132 }
|
bsw@1045
|
133 ui.tag{
|
bsw@1045
|
134 tag = "label", attr = { ['for'] = "notify_level_none" },
|
bsw@1045
|
135 content = _"I do not like to receive notifications by email"
|
bsw@1045
|
136 }
|
bsw@1045
|
137 end }
|
bsw@1045
|
138
|
bsw@1045
|
139 slot.put("<br />")
|
bsw@1045
|
140
|
bsw@1045
|
141 ui.tag{
|
bsw@1045
|
142 tag = "input",
|
bsw@1045
|
143 attr = {
|
bsw@1045
|
144 type = "submit",
|
bsw@1045
|
145 class = "btn btn-default",
|
bsw@1045
|
146 value = _"Save"
|
bsw@1045
|
147 },
|
bsw@1045
|
148 content = ""
|
bsw@348
|
149 }
|
bsw@1045
|
150 slot.put("<br /><br /><br />")
|
bsw@1045
|
151
|
bsw@1045
|
152 slot.put(" ")
|
bsw@1045
|
153 if return_to == "home" then
|
bsw@1045
|
154 ui.link {
|
bsw@1045
|
155 module = "index", view = "index",
|
bsw@1045
|
156 content = _"cancel"
|
bsw@1045
|
157 }
|
bsw@1045
|
158 else
|
bsw@1045
|
159 ui.link {
|
bsw@1045
|
160 module = "member", view = "show", id = app.session.member_id,
|
bsw@1045
|
161 content = _"cancel"
|
bsw@1045
|
162 }
|
bsw@1045
|
163 end
|
bsw@1045
|
164 end )
|
bsw@1045
|
165 end )
|
bsw@474
|
166
|
bsw@286
|
167 end
|
bsw@286
|
168 }
|
bsw@287
|
169
|