liquid_feedback_frontend

annotate 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
rev   line source
bsw@1045 1 local return_to = param.get("return_to")
bsw@1250 2 local return_to_area_id param.get("return_to_area_id", atom.integer)
bsw@1045 3
bsw@1126 4 ui.titleMember(_"notification settings")
bsw@286 5
bsw@1045 6 execute.view {
bsw@1045 7 module = "member", view = "_sidebar_whatcanido", params = {
bsw@1045 8 member = app.session.member
bsw@1045 9 }
bsw@1045 10 }
bsw@286 11
bsw@286 12 ui.form{
bsw@286 13 attr = { class = "vertical" },
bsw@286 14 module = "member",
bsw@348 15 action = "update_notify_level",
bsw@286 16 routing = {
bsw@286 17 ok = {
bsw@286 18 mode = "redirect",
bsw@1250 19 module = return_to == "area" and "area" or return_to == "home" and "index" or "member",
bsw@1250 20 view = return_to == "area" and "show" or return_to == "home" and "index" or "show",
bsw@1250 21 id = return_to == "area" and return_to_area_id or return_to ~= "home" and app.session.member_id or nil
bsw@286 22 }
bsw@286 23 },
bsw@286 24 content = function()
bsw@1045 25
bsw@1045 26 ui.section( function()
bsw@1045 27
bsw@1045 28 ui.sectionHead( function()
bsw@1250 29 ui.heading { level = 1, content = _"Do you like to receive updates by email?" }
bsw@1045 30 end )
bsw@1045 31
bsw@474 32
bsw@1045 33 ui.sectionRow( function()
bsw@1045 34
bsw@1045 35 ui.container{ content = function()
bsw@1045 36 ui.tag{
bsw@1045 37 tag = "input",
bsw@1045 38 attr = {
bsw@1045 39 id = "notify_level_all",
bsw@1248 40 type = "radio", name = "disable_notifications", value = "false",
bsw@1248 41 checked = not app.session.member.disable_notifications and "checked" or nil
bsw@1045 42 }
bsw@1045 43 }
bsw@1045 44 ui.tag{
bsw@1045 45 tag = "label", attr = { ['for'] = "notify_level_all" },
bsw@1045 46 content = _"I like to receive notifications"
bsw@1045 47 }
bsw@1045 48 end }
bsw@1045 49
bsw@1045 50 slot.put("<br />")
bsw@1255 51
bsw@1261 52 ui.container{ attr = { style = "margin-left: 3em;" }, content = function()
bsw@1255 53
bsw@1261 54 ui.container{ content = function()
bsw@1261 55 ui.tag{
bsw@1261 56 tag = "input",
bsw@1261 57 attr = {
bsw@1261 58 id = "digest_on",
bsw@1261 59 type = "radio", name = "digest", value = "true",
bsw@1266 60 checked = app.session.member.notification_hour ~= nil and "checked" or nil
bsw@1261 61 }
bsw@1261 62 }
bsw@1261 63 ui.tag{
bsw@1261 64 tag = "label", attr = { ['for'] = "digest_on" },
bsw@1261 65 content = _"Send me updates on issue phase changes and a regular digest"
bsw@1261 66 }
bsw@1262 67 end }
bsw@1261 68
bsw@1266 69 ui.container{ attr = { style = "margin-left: 4em;" }, content = function()
bsw@1261 70 ui.tag{ content = _"Day:" }
bsw@1261 71 slot.put(" ")
bsw@1261 72 ui.field.select{
bsw@1261 73 container_attr = { style = "display: inline-block; width: 10em; vertical-align: middle;" },
bsw@1261 74 name = "notification_dow",
bsw@1261 75 foreign_records = {
bsw@1261 76 { id = "daily", name = _"daily" },
bsw@1271 77 { id = 0, name = _"Sunday" },
bsw@1271 78 { id = 1, name = _"Monday" },
bsw@1271 79 { id = 2, name = _"Tuesday" },
bsw@1271 80 { id = 3, name = _"Wednesday" },
bsw@1271 81 { id = 4, name = _"Thursday" },
bsw@1271 82 { id = 5, name = _"Friday" },
bsw@1271 83 { id = 6, name = _"Saturday" }
bsw@1261 84 },
bsw@1261 85 foreign_id = "id",
bsw@1272 86 foreign_name = "name",
bsw@1272 87 value = app.session.member.notification_dow
bsw@1255 88 }
bsw@1261 89
bsw@1261 90 slot.put(" ")
bsw@1261 91
bsw@1261 92 ui.tag{ content = _"Hour:" }
bsw@1261 93 slot.put(" ")
bsw@1261 94 local foreign_records = {}
bsw@1261 95 for i = 0, 23 do
bsw@1261 96 foreign_records[#foreign_records+1] = {
bsw@1261 97 id = i,
bsw@1267 98 name = string.format("%02d - %02d", i, i+1),
bsw@1261 99 }
bsw@1261 100 end
bsw@1261 101 ui.field.select{
bsw@1261 102 container_attr = { style = "display: inline-block; width: 3em; vertical-align: middle;" },
bsw@1261 103 name = "notification_hour",
bsw@1261 104 foreign_records = foreign_records,
bsw@1261 105 foreign_id = "id",
bsw@1268 106 foreign_name = "name",
bsw@1272 107 value = app.session.member.notification_hour
bsw@1261 108 }
bsw@1261 109 end }
bsw@1261 110
bsw@1261 111 ui.container{ content = function()
bsw@1261 112 ui.tag{
bsw@1261 113 tag = "input",
bsw@1261 114 attr = {
bsw@1261 115 id = "digest_off",
bsw@1261 116 type = "radio", name = "digest", value = "false",
bsw@1266 117 checked = app.session.member.notification_dow == nil and app.session.member.hotification_hour == nil and "checked" or nil
bsw@1261 118 }
bsw@1261 119 }
bsw@1261 120 ui.tag{
bsw@1261 121 tag = "label", attr = { ['for'] = "digest_off" },
bsw@1261 122 content = _"Send me only updates on issue phase changes"
bsw@1261 123 }
bsw@1261 124 end }
bsw@1255 125 end }
bsw@1255 126
bsw@1263 127 slot.put("<br />")
bsw@1255 128
bsw@1045 129 ui.container{ content = function()
bsw@1045 130 ui.tag{
bsw@1045 131 tag = "input",
bsw@1045 132 attr = {
bsw@1045 133 id = "notify_level_none",
bsw@1248 134 type = "radio", name = "disable_notifications", value = "true",
bsw@1248 135 checked = app.session.member.disable_notifications and "checked" or nil
bsw@1045 136 }
bsw@1045 137 }
bsw@1045 138 ui.tag{
bsw@1045 139 tag = "label", attr = { ['for'] = "notify_level_none" },
bsw@1045 140 content = _"I do not like to receive notifications by email"
bsw@1045 141 }
bsw@1045 142 end }
bsw@1045 143
bsw@1045 144 slot.put("<br />")
bsw@1045 145
bsw@1045 146 ui.tag{
bsw@1045 147 tag = "input",
bsw@1045 148 attr = {
bsw@1045 149 type = "submit",
bsw@1045 150 class = "btn btn-default",
bsw@1045 151 value = _"Save"
bsw@1045 152 },
bsw@1045 153 content = ""
bsw@348 154 }
bsw@1045 155 slot.put("<br /><br /><br />")
bsw@1045 156
bsw@1045 157 slot.put(" ")
bsw@1045 158 if return_to == "home" then
bsw@1045 159 ui.link {
bsw@1045 160 module = "index", view = "index",
bsw@1045 161 content = _"cancel"
bsw@1045 162 }
bsw@1045 163 else
bsw@1045 164 ui.link {
bsw@1045 165 module = "member", view = "show", id = app.session.member_id,
bsw@1045 166 content = _"cancel"
bsw@1045 167 }
bsw@1045 168 end
bsw@1045 169 end )
bsw@1045 170 end )
bsw@474 171
bsw@286 172 end
bsw@286 173 }
bsw@287 174

Impressum / About Us