liquid_feedback_frontend
changeset 1255:1d645a8d20fc
Updates to notification system user config
author | bsw |
---|---|
date | Sun Apr 17 16:47:05 2016 +0200 (2016-04-17) |
parents | 55132e0324a4 |
children | 0455f101565c |
files | app/main/member/_action/update_notify_level.lua app/main/member/settings_notification.lua |
line diff
1.1 --- a/app/main/member/_action/update_notify_level.lua Sun Apr 17 16:14:21 2016 +0200 1.2 +++ b/app/main/member/_action/update_notify_level.lua Sun Apr 17 16:47:05 2016 +0200 1.3 @@ -1,3 +1,21 @@ 1.4 -app.session.member.disable_notifications = param.get("disable_notifications") == "true" and true or false 1.5 -IgnoredArea:destroy_by_member_id(app.session.member_id) 1.6 +local disable_notifications = param.get("disable_notifications") == "true" and true or false 1.7 + 1.8 +if app.session.member.disable_notifications ~= disable_notifications then 1.9 + IgnoredArea:destroy_by_member_id(app.session.member_id) 1.10 + app.session.member.disable_notifications = disable_notifications 1.11 +end 1.12 + 1.13 +if param.get("digest", atom.boolean) the 1.14 + local dow = param.get("digest_dow") 1.15 + if dow == "daily" then 1.16 + app.session.member.digest_dow = nil 1.17 + else 1.18 + app.session.member.digest_dow = tonumber(dow) 1.19 + end 1.20 + app.session.member.digest_hour = param.get("digest_hour", atom.number) 1.21 +else 1.22 + app.session.member.digest_dow = nil 1.23 + app.session.member.digest_hour = nil 1.24 +end 1.25 + 1.26 app.session.member:save()
2.1 --- a/app/main/member/settings_notification.lua Sun Apr 17 16:14:21 2016 +0200 2.2 +++ b/app/main/member/settings_notification.lua Sun Apr 17 16:47:05 2016 +0200 2.3 @@ -48,7 +48,75 @@ 2.4 end } 2.5 2.6 slot.put("<br />") 2.7 + 2.8 + ui.container{ content = function() 2.9 + ui.tag{ 2.10 + tag = "input", 2.11 + attr = { 2.12 + id = "digest_on", 2.13 + type = "radio", name = "digest", value = "true", 2.14 + checked = not app.session.member.digest_dow and "checked" or nil 2.15 + } 2.16 + } 2.17 + ui.tag{ 2.18 + tag = "label", attr = { ['for'] = "digest_on" }, 2.19 + content = _"Send me updates on issue phase changes and a regular digest" 2.20 + } 2.21 + 2.22 + ui.tag{ content = _"Day:" } 2.23 + slot.put(" ") 2.24 + ui.field.select{ 2.25 + name = "notification_dow", 2.26 + foreign_records = { 2.27 + "daily" = _"daily", 2.28 + 0 = _"Sunday", 2.29 + 1 = _"Monday", 2.30 + 2 = _"Tuesday", 2.31 + 3 = _"Wednesday", 2.32 + 4 = _"Thursday", 2.33 + 5 = _"Friday", 2.34 + 6 = _"Saturday", 2.35 + 7 = _"Sunday", 2.36 + } 2.37 + } 2.38 + 2.39 + slot.put(" ") 2.40 2.41 + ui.tag{ content = _"Hour:" } 2.42 + slot.put(" ") 2.43 + local foreign_records = {} 2.44 + for i = 0, 23 do 2.45 + foreign_records[#foreign_records+1] = { 2.46 + id = i, 2.47 + name = printf("%02d", i), 2.48 + } 2.49 + end 2.50 + ui.field.select{ 2.51 + name = "notification_hour", 2.52 + foreign_records = foreign_records, 2.53 + foreign_id = "id", 2.54 + foreign_name = "name" 2.55 + } 2.56 + end } 2.57 + end } 2.58 + 2.59 + ui.container{ content = function() 2.60 + ui.tag{ 2.61 + tag = "input", 2.62 + attr = { 2.63 + id = "digest_off", 2.64 + type = "radio", name = "digest", value = "false", 2.65 + checked = not app.session.member.digest_dow and "checked" or nil 2.66 + } 2.67 + } 2.68 + ui.tag{ 2.69 + tag = "label", attr = { ['for'] = "digest_off" }, 2.70 + content = _"Send me only updates on issue phase changes" 2.71 + } 2.72 + end } 2.73 + 2.74 + 2.75 + 2.76 ui.container{ content = function() 2.77 ui.tag{ 2.78 tag = "input",