liquid_feedback_frontend

view app/main/member/settings_notification.lua @ 1261:0f4925c2843a

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

Impressum / About Us