liquid_feedback_frontend

view app/main/member/settings_notification.lua @ 1260:775b0b040d8f

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

Impressum / About Us