liquid_feedback_frontend

annotate app/main/member/settings_notification.lua @ 1262:ce6113ce6635

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

Impressum / About Us