liquid_feedback_frontend

annotate 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
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@1045 32 ui.sectionRow( function()
bsw@1045 33
bsw@1045 34 ui.container{ content = function()
bsw@1045 35 ui.tag{
bsw@1045 36 tag = "input",
bsw@1045 37 attr = {
bsw@1045 38 id = "notify_level_all",
bsw@1248 39 type = "radio", name = "disable_notifications", value = "false",
bsw@1282 40 checked = not app.session.member.disable_notifications and "checked" or nil,
bsw@1281 41 onchange = [[ $(".view_on_notify_level_all_false")[this.checked ? "show" : "hide"](400) ]]
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@1255 50
bsw@1281 51 ui.container{ attr = { class = "view_on_notify_level_all_false", style = "margin-left: 3em;" }, content = function()
bsw@1283 52 slot.put("<br />")
bsw@1277 53
bsw@1277 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." }
bsw@1279 55 slot.put("<br />")
bsw@1261 56 ui.container{ content = function()
bsw@1261 57 ui.tag{
bsw@1261 58 tag = "input",
bsw@1261 59 attr = {
bsw@1261 60 id = "digest_on",
bsw@1261 61 type = "radio", name = "digest", value = "true",
bsw@1282 62 checked = app.session.member.notification_hour ~= nil and "checked" or nil,
bsw@1281 63 onchange = [[ $(".view_on_digest_true")[this.checked ? "show" : "hide"](400) ]]
bsw@1261 64 }
bsw@1261 65 }
bsw@1261 66 ui.tag{
bsw@1261 67 tag = "label", attr = { ['for'] = "digest_on" },
bsw@1277 68 content = _"I want to receive a regular digest. Send the digest at:"
bsw@1261 69 }
bsw@1262 70 end }
bsw@1261 71
bsw@1281 72 ui.container{ attr = { class = "view_on_digest_true", style = "margin-left: 4em;" }, content = function()
bsw@1261 73 ui.tag{ content = _"Day:" }
bsw@1261 74 slot.put(" ")
bsw@1261 75 ui.field.select{
bsw@1273 76 container_attr = { style = "display: inline-block; vertical-align: middle;" },
bsw@1274 77 attr = { style = "width: 10em;" },
bsw@1261 78 name = "notification_dow",
bsw@1261 79 foreign_records = {
bsw@1261 80 { id = "daily", name = _"daily" },
bsw@1271 81 { id = 0, name = _"Sunday" },
bsw@1271 82 { id = 1, name = _"Monday" },
bsw@1271 83 { id = 2, name = _"Tuesday" },
bsw@1271 84 { id = 3, name = _"Wednesday" },
bsw@1271 85 { id = 4, name = _"Thursday" },
bsw@1271 86 { id = 5, name = _"Friday" },
bsw@1271 87 { id = 6, name = _"Saturday" }
bsw@1261 88 },
bsw@1261 89 foreign_id = "id",
bsw@1272 90 foreign_name = "name",
bsw@1272 91 value = app.session.member.notification_dow
bsw@1255 92 }
bsw@1261 93
bsw@1261 94 slot.put(" ")
bsw@1261 95
bsw@1261 96 ui.tag{ content = _"Hour:" }
bsw@1261 97 slot.put(" ")
bsw@1261 98 local foreign_records = {}
bsw@1261 99 for i = 0, 23 do
bsw@1261 100 foreign_records[#foreign_records+1] = {
bsw@1261 101 id = i,
bsw@1277 102 name = string.format("%02d:00 - %02d:59", i, i),
bsw@1261 103 }
bsw@1261 104 end
bsw@1261 105 ui.field.select{
bsw@1273 106 container_attr = { style = "display: inline-block; vertical-align: middle;" },
bsw@1280 107 attr = { style = "width: 10em;" },
bsw@1261 108 name = "notification_hour",
bsw@1261 109 foreign_records = foreign_records,
bsw@1261 110 foreign_id = "id",
bsw@1268 111 foreign_name = "name",
bsw@1272 112 value = app.session.member.notification_hour
bsw@1261 113 }
bsw@1261 114 end }
bsw@1261 115
bsw@1261 116 ui.container{ content = function()
bsw@1261 117 ui.tag{
bsw@1261 118 tag = "input",
bsw@1261 119 attr = {
bsw@1261 120 id = "digest_off",
bsw@1261 121 type = "radio", name = "digest", value = "false",
bsw@1282 122 checked = app.session.member.notification_dow == nil and app.session.member.notification_hour == nil and "checked" or nil,
bsw@1281 123 onchange = [[ $(".view_on_digest_true")[this.checked ? "hide" : "show"](400) ]]
bsw@1261 124 }
bsw@1261 125 }
bsw@1261 126 ui.tag{
bsw@1261 127 tag = "label", attr = { ['for'] = "digest_off" },
bsw@1279 128 content = _"Don't send me a digest"
bsw@1261 129 }
bsw@1261 130 end }
bsw@1255 131 end }
bsw@1255 132
bsw@1263 133 slot.put("<br />")
bsw@1255 134
bsw@1045 135 ui.container{ content = function()
bsw@1045 136 ui.tag{
bsw@1045 137 tag = "input",
bsw@1045 138 attr = {
bsw@1045 139 id = "notify_level_none",
bsw@1248 140 type = "radio", name = "disable_notifications", value = "true",
bsw@1281 141 checked = app.session.member.disable_notifications and "checked" or nil,
bsw@1281 142 onchange = [[ $(".view_on_notify_level_all_false")[this.checked ? "hide" : "show"](400) ]]
bsw@1045 143 }
bsw@1045 144 }
bsw@1045 145 ui.tag{
bsw@1045 146 tag = "label", attr = { ['for'] = "notify_level_none" },
bsw@1279 147 content = _"Don't send me notifications by email"
bsw@1045 148 }
bsw@1045 149 end }
bsw@1045 150
bsw@1282 151 if app.session.member.disable_notifications then
bsw@1282 152 ui.script{ script = [[ $(".view_on_notify_level_all_false").hide() ]] }
bsw@1282 153 end
bsw@1282 154
bsw@1282 155 if app.session.member.notification_hour == nil then
bsw@1282 156 ui.script{ script = [[ $(".view_on_digest_true").hide() ]] }
bsw@1282 157 end
bsw@1282 158
bsw@1045 159 slot.put("<br />")
bsw@1045 160
bsw@1045 161 ui.tag{
bsw@1045 162 tag = "input",
bsw@1045 163 attr = {
bsw@1045 164 type = "submit",
bsw@1045 165 class = "btn btn-default",
bsw@1045 166 value = _"Save"
bsw@1045 167 },
bsw@1045 168 content = ""
bsw@348 169 }
bsw@1045 170 slot.put("<br /><br /><br />")
bsw@1045 171
bsw@1045 172 slot.put(" ")
bsw@1045 173 if return_to == "home" then
bsw@1045 174 ui.link {
bsw@1045 175 module = "index", view = "index",
bsw@1045 176 content = _"cancel"
bsw@1045 177 }
bsw@1045 178 else
bsw@1045 179 ui.link {
bsw@1045 180 module = "member", view = "show", id = app.session.member_id,
bsw@1045 181 content = _"cancel"
bsw@1045 182 }
bsw@1045 183 end
bsw@1045 184 end )
bsw@1045 185 end )
bsw@474 186
bsw@286 187 end
bsw@286 188 }
bsw@287 189

Impressum / About Us