liquid_feedback_frontend

view app/main/member/settings_notification.lua @ 1272:4be7efb236ce

Fixes on notification system
author bsw
date Sun Apr 17 17:23:13 2016 +0200 (2016-04-17)
parents f7380592513a
children 0fda5edca3af
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; 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 value = app.session.member.notification_dow
88 }
90 slot.put(" ")
92 ui.tag{ content = _"Hour:" }
93 slot.put(" ")
94 local foreign_records = {}
95 for i = 0, 23 do
96 foreign_records[#foreign_records+1] = {
97 id = i,
98 name = string.format("%02d - %02d", i, i+1),
99 }
100 end
101 ui.field.select{
102 container_attr = { style = "display: inline-block; width: 3em; vertical-align: middle;" },
103 name = "notification_hour",
104 foreign_records = foreign_records,
105 foreign_id = "id",
106 foreign_name = "name",
107 value = app.session.member.notification_hour
108 }
109 end }
111 ui.container{ content = function()
112 ui.tag{
113 tag = "input",
114 attr = {
115 id = "digest_off",
116 type = "radio", name = "digest", value = "false",
117 checked = app.session.member.notification_dow == nil and app.session.member.hotification_hour == nil and "checked" or nil
118 }
119 }
120 ui.tag{
121 tag = "label", attr = { ['for'] = "digest_off" },
122 content = _"Send me only updates on issue phase changes"
123 }
124 end }
125 end }
127 slot.put("<br />")
129 ui.container{ content = function()
130 ui.tag{
131 tag = "input",
132 attr = {
133 id = "notify_level_none",
134 type = "radio", name = "disable_notifications", value = "true",
135 checked = app.session.member.disable_notifications and "checked" or nil
136 }
137 }
138 ui.tag{
139 tag = "label", attr = { ['for'] = "notify_level_none" },
140 content = _"I do not like to receive notifications by email"
141 }
142 end }
144 slot.put("<br />")
146 ui.tag{
147 tag = "input",
148 attr = {
149 type = "submit",
150 class = "btn btn-default",
151 value = _"Save"
152 },
153 content = ""
154 }
155 slot.put("<br /><br /><br />")
157 slot.put(" ")
158 if return_to == "home" then
159 ui.link {
160 module = "index", view = "index",
161 content = _"cancel"
162 }
163 else
164 ui.link {
165 module = "member", view = "show", id = app.session.member_id,
166 content = _"cancel"
167 }
168 end
169 end )
170 end )
172 end
173 }

Impressum / About Us