liquid_feedback_frontend

view app/main/member/settings_notification.lua @ 1274:a354b929e785

Fixes on notification system
author bsw
date Sun Apr 17 17:25:16 2016 +0200 (2016-04-17)
parents 0fda5edca3af
children 3f725cfd4547
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 = app.session.member.notification_hour ~= nil 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{ attr = { style = "margin-left: 4em;" }, content = function()
70 ui.tag{ content = _"Day:" }
71 slot.put(" ")
72 ui.field.select{
73 container_attr = { style = "display: inline-block; vertical-align: middle;" },
74 attr = { style = "width: 10em;" },
75 name = "notification_dow",
76 foreign_records = {
77 { id = "daily", name = _"daily" },
78 { id = 0, name = _"Sunday" },
79 { id = 1, name = _"Monday" },
80 { id = 2, name = _"Tuesday" },
81 { id = 3, name = _"Wednesday" },
82 { id = 4, name = _"Thursday" },
83 { id = 5, name = _"Friday" },
84 { id = 6, name = _"Saturday" }
85 },
86 foreign_id = "id",
87 foreign_name = "name",
88 value = app.session.member.notification_dow
89 }
91 slot.put(" ")
93 ui.tag{ content = _"Hour:" }
94 slot.put(" ")
95 local foreign_records = {}
96 for i = 0, 23 do
97 foreign_records[#foreign_records+1] = {
98 id = i,
99 name = string.format("%02d - %02d", i, i+1),
100 }
101 end
102 ui.field.select{
103 container_attr = { style = "display: inline-block; vertical-align: middle;" },
104 attr = { style = "width: 6em;" },
105 name = "notification_hour",
106 foreign_records = foreign_records,
107 foreign_id = "id",
108 foreign_name = "name",
109 value = app.session.member.notification_hour
110 }
111 end }
113 ui.container{ content = function()
114 ui.tag{
115 tag = "input",
116 attr = {
117 id = "digest_off",
118 type = "radio", name = "digest", value = "false",
119 checked = app.session.member.notification_dow == nil and app.session.member.hotification_hour == nil and "checked" or nil
120 }
121 }
122 ui.tag{
123 tag = "label", attr = { ['for'] = "digest_off" },
124 content = _"Send me only updates on issue phase changes"
125 }
126 end }
127 end }
129 slot.put("<br />")
131 ui.container{ content = function()
132 ui.tag{
133 tag = "input",
134 attr = {
135 id = "notify_level_none",
136 type = "radio", name = "disable_notifications", value = "true",
137 checked = app.session.member.disable_notifications and "checked" or nil
138 }
139 }
140 ui.tag{
141 tag = "label", attr = { ['for'] = "notify_level_none" },
142 content = _"I do not like to receive notifications by email"
143 }
144 end }
146 slot.put("<br />")
148 ui.tag{
149 tag = "input",
150 attr = {
151 type = "submit",
152 class = "btn btn-default",
153 value = _"Save"
154 },
155 content = ""
156 }
157 slot.put("<br /><br /><br />")
159 slot.put(" ")
160 if return_to == "home" then
161 ui.link {
162 module = "index", view = "index",
163 content = _"cancel"
164 }
165 else
166 ui.link {
167 module = "member", view = "show", id = app.session.member_id,
168 content = _"cancel"
169 }
170 end
171 end )
172 end )
174 end
175 }

Impressum / About Us