liquid_feedback_frontend

view app/main/member/settings_notification.lua @ 1262:ce6113ce6635

Fixes on notification system
author bsw
date Sun Apr 17 17:01:40 2016 +0200 (2016-04-17)
parents 0f4925c2843a
children 0550850aedfd
line source
1 local return_to = param.get("return_to")
2 local return_to_area_id param.get("return_to_area_id", atom.integer)
4 ui.titleMember(_"notification settings")
6 execute.view {
7 module = "member", view = "_sidebar_whatcanido", params = {
8 member = app.session.member
9 }
10 }
12 ui.form{
13 attr = { class = "vertical" },
14 module = "member",
15 action = "update_notify_level",
16 routing = {
17 ok = {
18 mode = "redirect",
19 module = return_to == "area" and "area" or return_to == "home" and "index" or "member",
20 view = return_to == "area" and "show" or return_to == "home" and "index" or "show",
21 id = return_to == "area" and return_to_area_id or return_to ~= "home" and app.session.member_id or nil
22 }
23 },
24 content = function()
26 ui.section( function()
28 ui.sectionHead( function()
29 ui.heading { level = 1, content = _"Do you like to receive updates by email?" }
30 end )
33 ui.sectionRow( function()
35 ui.container{ content = function()
36 ui.tag{
37 tag = "input",
38 attr = {
39 id = "notify_level_all",
40 type = "radio", name = "disable_notifications", value = "false",
41 checked = not app.session.member.disable_notifications and "checked" or nil
42 }
43 }
44 ui.tag{
45 tag = "label", attr = { ['for'] = "notify_level_all" },
46 content = _"I like to receive notifications"
47 }
48 end }
50 slot.put("<br />")
52 ui.container{ attr = { style = "margin-left: 3em;" }, content = function()
54 ui.container{ content = function()
55 ui.tag{
56 tag = "input",
57 attr = {
58 id = "digest_on",
59 type = "radio", name = "digest", value = "true",
60 checked = not app.session.member.digest_dow and "checked" or nil
61 }
62 }
63 ui.tag{
64 tag = "label", attr = { ['for'] = "digest_on" },
65 content = _"Send me updates on issue phase changes and a regular digest"
66 }
67 end }
69 ui.container{ content = function()
70 ui.tag{ content = _"Day:" }
71 slot.put(" ")
72 ui.field.select{
73 container_attr = { style = "display: inline-block; width: 10em; vertical-align: middle;" },
74 name = "notification_dow",
75 foreign_records = {
76 { id = "daily", name = _"daily" },
77 { id = "0", name = _"Sunday" },
78 { id = "1", name = _"Monday" },
79 { id = "2", name = _"Tuesday" },
80 { id = "3", name = _"Wednesday" },
81 { id = "4", name = _"Thursday" },
82 { id = "5", name = _"Friday" },
83 { id = "6", name = _"Saturday" }
84 },
85 foreign_id = "id",
86 foreign_name = "name"
87 }
89 slot.put(" ")
91 ui.tag{ content = _"Hour:" }
92 slot.put(" ")
93 local foreign_records = {}
94 for i = 0, 23 do
95 foreign_records[#foreign_records+1] = {
96 id = i,
97 name = string.format("%02d", i),
98 }
99 end
100 ui.field.select{
101 container_attr = { style = "display: inline-block; width: 3em; vertical-align: middle;" },
102 name = "notification_hour",
103 foreign_records = foreign_records,
104 foreign_id = "id",
105 foreign_name = "name"
106 }
107 end }
109 ui.container{ content = function()
110 ui.tag{
111 tag = "input",
112 attr = {
113 id = "digest_off",
114 type = "radio", name = "digest", value = "false",
115 checked = not app.session.member.digest_dow and "checked" or nil
116 }
117 }
118 ui.tag{
119 tag = "label", attr = { ['for'] = "digest_off" },
120 content = _"Send me only updates on issue phase changes"
121 }
122 end }
123 end }
126 ui.container{ content = function()
127 ui.tag{
128 tag = "input",
129 attr = {
130 id = "notify_level_none",
131 type = "radio", name = "disable_notifications", value = "true",
132 checked = app.session.member.disable_notifications and "checked" or nil
133 }
134 }
135 ui.tag{
136 tag = "label", attr = { ['for'] = "notify_level_none" },
137 content = _"I do not like to receive notifications by email"
138 }
139 end }
141 slot.put("<br />")
143 ui.tag{
144 tag = "input",
145 attr = {
146 type = "submit",
147 class = "btn btn-default",
148 value = _"Save"
149 },
150 content = ""
151 }
152 slot.put("<br /><br /><br />")
154 slot.put(" ")
155 if return_to == "home" then
156 ui.link {
157 module = "index", view = "index",
158 content = _"cancel"
159 }
160 else
161 ui.link {
162 module = "member", view = "show", id = app.session.member_id,
163 content = _"cancel"
164 }
165 end
166 end )
167 end )
169 end
170 }

Impressum / About Us