liquid_feedback_frontend

view app/main/member/settings_notification.lua @ 1281:5b97578192bc

Hide not needed parts of notification configuration view
author bsw
date Mon Apr 18 09:38:27 2016 +0200 (2016-04-18)
parents deb01dfd4429
children 0bd5142b9c5e
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 onchange = [[ $(".view_on_notify_level_all_false")[this.checked ? "show" : "hide"](400) ]]
43 }
44 }
45 ui.tag{
46 tag = "label", attr = { ['for'] = "notify_level_all" },
47 content = _"I like to receive notifications"
48 }
49 end }
51 slot.put("<br />")
53 ui.container{ attr = { class = "view_on_notify_level_all_false", style = "margin-left: 3em;" }, content = function()
55 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." }
56 slot.put("<br />")
57 ui.container{ content = function()
58 ui.tag{
59 tag = "input",
60 attr = {
61 id = "digest_on",
62 type = "radio", name = "digest", value = "true",
63 checked = app.session.member.notification_hour ~= nil and "checked" or nil
64 onchange = [[ $(".view_on_digest_true")[this.checked ? "show" : "hide"](400) ]]
65 }
66 }
67 ui.tag{
68 tag = "label", attr = { ['for'] = "digest_on" },
69 content = _"I want to receive a regular digest. Send the digest at:"
70 }
71 end }
73 ui.container{ attr = { class = "view_on_digest_true", style = "margin-left: 4em;" }, content = function()
74 ui.tag{ content = _"Day:" }
75 slot.put(" ")
76 ui.field.select{
77 container_attr = { style = "display: inline-block; vertical-align: middle;" },
78 attr = { style = "width: 10em;" },
79 name = "notification_dow",
80 foreign_records = {
81 { id = "daily", name = _"daily" },
82 { id = 0, name = _"Sunday" },
83 { id = 1, name = _"Monday" },
84 { id = 2, name = _"Tuesday" },
85 { id = 3, name = _"Wednesday" },
86 { id = 4, name = _"Thursday" },
87 { id = 5, name = _"Friday" },
88 { id = 6, name = _"Saturday" }
89 },
90 foreign_id = "id",
91 foreign_name = "name",
92 value = app.session.member.notification_dow
93 }
95 slot.put(" ")
97 ui.tag{ content = _"Hour:" }
98 slot.put(" ")
99 local foreign_records = {}
100 for i = 0, 23 do
101 foreign_records[#foreign_records+1] = {
102 id = i,
103 name = string.format("%02d:00 - %02d:59", i, i),
104 }
105 end
106 ui.field.select{
107 container_attr = { style = "display: inline-block; vertical-align: middle;" },
108 attr = { style = "width: 10em;" },
109 name = "notification_hour",
110 foreign_records = foreign_records,
111 foreign_id = "id",
112 foreign_name = "name",
113 value = app.session.member.notification_hour
114 }
115 end }
117 ui.container{ content = function()
118 ui.tag{
119 tag = "input",
120 attr = {
121 id = "digest_off",
122 type = "radio", name = "digest", value = "false",
123 checked = app.session.member.notification_dow == nil and app.session.member.notification_hour == nil and "checked" or nil
124 onchange = [[ $(".view_on_digest_true")[this.checked ? "hide" : "show"](400) ]]
125 }
126 }
127 ui.tag{
128 tag = "label", attr = { ['for'] = "digest_off" },
129 content = _"Don't send me a digest"
130 }
131 end }
132 end }
134 slot.put("<br />")
136 ui.container{ content = function()
137 ui.tag{
138 tag = "input",
139 attr = {
140 id = "notify_level_none",
141 type = "radio", name = "disable_notifications", value = "true",
142 checked = app.session.member.disable_notifications and "checked" or nil,
143 onchange = [[ $(".view_on_notify_level_all_false")[this.checked ? "hide" : "show"](400) ]]
144 }
145 }
146 ui.tag{
147 tag = "label", attr = { ['for'] = "notify_level_none" },
148 content = _"Don't send me notifications by email"
149 }
150 end }
152 slot.put("<br />")
154 ui.tag{
155 tag = "input",
156 attr = {
157 type = "submit",
158 class = "btn btn-default",
159 value = _"Save"
160 },
161 content = ""
162 }
163 slot.put("<br /><br /><br />")
165 slot.put(" ")
166 if return_to == "home" then
167 ui.link {
168 module = "index", view = "index",
169 content = _"cancel"
170 }
171 else
172 ui.link {
173 module = "member", view = "show", id = app.session.member_id,
174 content = _"cancel"
175 }
176 end
177 end )
178 end )
180 end
181 }

Impressum / About Us