liquid_feedback_frontend

annotate app/main/member/settings_notification.lua @ 1273:0fda5edca3af

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

Impressum / About Us