liquid_feedback_frontend

view app/main/member/settings_notification.lua @ 1283:37359fcc2bd9

Layout issue fixed
author bsw
date Mon Apr 18 09:49:05 2016 +0200 (2016-04-18)
parents 0bd5142b9c5e
children 2bd70367dda8
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 )
32 ui.sectionRow( function()
34 ui.container{ content = function()
35 ui.tag{
36 tag = "input",
37 attr = {
38 id = "notify_level_all",
39 type = "radio", name = "disable_notifications", value = "false",
40 checked = not app.session.member.disable_notifications and "checked" or nil,
41 onchange = [[ $(".view_on_notify_level_all_false")[this.checked ? "show" : "hide"](400) ]]
42 }
43 }
44 ui.tag{
45 tag = "label", attr = { ['for'] = "notify_level_all" },
46 content = _"I like to receive notifications"
47 }
48 end }
51 ui.container{ attr = { class = "view_on_notify_level_all_false", style = "margin-left: 3em;" }, content = function()
52 slot.put("<br />")
54 ui.container{ content = _"You will receive status update notification on issue phase changes. Additionally you can subscribe for a regular digest including updates on initiative drafts and new suggestions." }
55 slot.put("<br />")
56 ui.container{ content = function()
57 ui.tag{
58 tag = "input",
59 attr = {
60 id = "digest_on",
61 type = "radio", name = "digest", value = "true",
62 checked = app.session.member.notification_hour ~= nil and "checked" or nil,
63 onchange = [[ $(".view_on_digest_true")[this.checked ? "show" : "hide"](400) ]]
64 }
65 }
66 ui.tag{
67 tag = "label", attr = { ['for'] = "digest_on" },
68 content = _"I want to receive a regular digest. Send the digest at:"
69 }
70 end }
72 ui.container{ attr = { class = "view_on_digest_true", style = "margin-left: 4em;" }, content = function()
73 ui.tag{ content = _"Day:" }
74 slot.put(" ")
75 ui.field.select{
76 container_attr = { style = "display: inline-block; vertical-align: middle;" },
77 attr = { style = "width: 10em;" },
78 name = "notification_dow",
79 foreign_records = {
80 { id = "daily", name = _"daily" },
81 { id = 0, name = _"Sunday" },
82 { id = 1, name = _"Monday" },
83 { id = 2, name = _"Tuesday" },
84 { id = 3, name = _"Wednesday" },
85 { id = 4, name = _"Thursday" },
86 { id = 5, name = _"Friday" },
87 { id = 6, name = _"Saturday" }
88 },
89 foreign_id = "id",
90 foreign_name = "name",
91 value = app.session.member.notification_dow
92 }
94 slot.put(" ")
96 ui.tag{ content = _"Hour:" }
97 slot.put(" ")
98 local foreign_records = {}
99 for i = 0, 23 do
100 foreign_records[#foreign_records+1] = {
101 id = i,
102 name = string.format("%02d:00 - %02d:59", i, i),
103 }
104 end
105 ui.field.select{
106 container_attr = { style = "display: inline-block; vertical-align: middle;" },
107 attr = { style = "width: 10em;" },
108 name = "notification_hour",
109 foreign_records = foreign_records,
110 foreign_id = "id",
111 foreign_name = "name",
112 value = app.session.member.notification_hour
113 }
114 end }
116 ui.container{ content = function()
117 ui.tag{
118 tag = "input",
119 attr = {
120 id = "digest_off",
121 type = "radio", name = "digest", value = "false",
122 checked = app.session.member.notification_dow == nil and app.session.member.notification_hour == nil and "checked" or nil,
123 onchange = [[ $(".view_on_digest_true")[this.checked ? "hide" : "show"](400) ]]
124 }
125 }
126 ui.tag{
127 tag = "label", attr = { ['for'] = "digest_off" },
128 content = _"Don't send me a digest"
129 }
130 end }
131 end }
133 slot.put("<br />")
135 ui.container{ content = function()
136 ui.tag{
137 tag = "input",
138 attr = {
139 id = "notify_level_none",
140 type = "radio", name = "disable_notifications", value = "true",
141 checked = app.session.member.disable_notifications and "checked" or nil,
142 onchange = [[ $(".view_on_notify_level_all_false")[this.checked ? "hide" : "show"](400) ]]
143 }
144 }
145 ui.tag{
146 tag = "label", attr = { ['for'] = "notify_level_none" },
147 content = _"Don't send me notifications by email"
148 }
149 end }
151 if app.session.member.disable_notifications then
152 ui.script{ script = [[ $(".view_on_notify_level_all_false").hide() ]] }
153 end
155 if app.session.member.notification_hour == nil then
156 ui.script{ script = [[ $(".view_on_digest_true").hide() ]] }
157 end
159 slot.put("<br />")
161 ui.tag{
162 tag = "input",
163 attr = {
164 type = "submit",
165 class = "btn btn-default",
166 value = _"Save"
167 },
168 content = ""
169 }
170 slot.put("<br /><br /><br />")
172 slot.put(" ")
173 if return_to == "home" then
174 ui.link {
175 module = "index", view = "index",
176 content = _"cancel"
177 }
178 else
179 ui.link {
180 module = "member", view = "show", id = app.session.member_id,
181 content = _"cancel"
182 }
183 end
184 end )
185 end )
187 end
188 }

Impressum / About Us