liquid_feedback_frontend

view app/main/member/settings_notification.lua @ 1259:4e63e92c9adc

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

Impressum / About Us