bsw@1045: local return_to = param.get("return_to") bsw@1250: local return_to_area_id param.get("return_to_area_id", atom.integer) bsw@1045: bsw@1126: ui.titleMember(_"notification settings") bsw@286: bsw@1045: execute.view { bsw@1045: module = "member", view = "_sidebar_whatcanido", params = { bsw@1045: member = app.session.member bsw@1045: } bsw@1045: } bsw@286: bsw@286: ui.form{ bsw@286: attr = { class = "vertical" }, bsw@286: module = "member", bsw@348: action = "update_notify_level", bsw@286: routing = { bsw@286: ok = { bsw@286: mode = "redirect", bsw@1250: module = return_to == "area" and "area" or return_to == "home" and "index" or "member", bsw@1250: view = return_to == "area" and "show" or return_to == "home" and "index" or "show", bsw@1250: id = return_to == "area" and return_to_area_id or return_to ~= "home" and app.session.member_id or nil bsw@286: } bsw@286: }, bsw@286: content = function() bsw@1045: bsw@1045: ui.section( function() bsw@1045: bsw@1045: ui.sectionHead( function() bsw@1250: ui.heading { level = 1, content = _"Do you like to receive updates by email?" } bsw@1045: end ) bsw@1045: bsw@474: bsw@1045: ui.sectionRow( function() bsw@1045: bsw@1045: ui.container{ content = function() bsw@1045: ui.tag{ bsw@1045: tag = "input", bsw@1045: attr = { bsw@1045: id = "notify_level_all", bsw@1248: type = "radio", name = "disable_notifications", value = "false", bsw@1248: checked = not app.session.member.disable_notifications and "checked" or nil bsw@1045: } bsw@1045: } bsw@1045: ui.tag{ bsw@1045: tag = "label", attr = { ['for'] = "notify_level_all" }, bsw@1045: content = _"I like to receive notifications" bsw@1045: } bsw@1045: end } bsw@1045: bsw@1045: slot.put("
") bsw@1255: bsw@1261: ui.container{ attr = { style = "margin-left: 3em;" }, content = function() bsw@1255: bsw@1261: ui.container{ content = function() bsw@1261: ui.tag{ bsw@1261: tag = "input", bsw@1261: attr = { bsw@1261: id = "digest_on", bsw@1261: type = "radio", name = "digest", value = "true", bsw@1266: checked = app.session.member.notification_hour ~= nil and "checked" or nil bsw@1261: } bsw@1261: } bsw@1261: ui.tag{ bsw@1261: tag = "label", attr = { ['for'] = "digest_on" }, bsw@1261: content = _"Send me updates on issue phase changes and a regular digest" bsw@1261: } bsw@1262: end } bsw@1261: bsw@1266: ui.container{ attr = { style = "margin-left: 4em;" }, content = function() bsw@1261: ui.tag{ content = _"Day:" } bsw@1261: slot.put(" ") bsw@1261: ui.field.select{ bsw@1273: container_attr = { style = "display: inline-block; vertical-align: middle;" }, bsw@1273: attr = { style = "width: 8em;" }, bsw@1261: name = "notification_dow", bsw@1261: foreign_records = { bsw@1261: { id = "daily", name = _"daily" }, bsw@1271: { id = 0, name = _"Sunday" }, bsw@1271: { id = 1, name = _"Monday" }, bsw@1271: { id = 2, name = _"Tuesday" }, bsw@1271: { id = 3, name = _"Wednesday" }, bsw@1271: { id = 4, name = _"Thursday" }, bsw@1271: { id = 5, name = _"Friday" }, bsw@1271: { id = 6, name = _"Saturday" } bsw@1261: }, bsw@1261: foreign_id = "id", bsw@1272: foreign_name = "name", bsw@1272: value = app.session.member.notification_dow bsw@1255: } bsw@1261: bsw@1261: slot.put(" ") bsw@1261: bsw@1261: ui.tag{ content = _"Hour:" } bsw@1261: slot.put(" ") bsw@1261: local foreign_records = {} bsw@1261: for i = 0, 23 do bsw@1261: foreign_records[#foreign_records+1] = { bsw@1261: id = i, bsw@1267: name = string.format("%02d - %02d", i, i+1), bsw@1261: } bsw@1261: end bsw@1261: ui.field.select{ bsw@1273: container_attr = { style = "display: inline-block; vertical-align: middle;" }, bsw@1273: attr = { style = "width: 4em;" }, bsw@1261: name = "notification_hour", bsw@1261: foreign_records = foreign_records, bsw@1261: foreign_id = "id", bsw@1268: foreign_name = "name", bsw@1272: value = app.session.member.notification_hour bsw@1261: } bsw@1261: end } bsw@1261: bsw@1261: ui.container{ content = function() bsw@1261: ui.tag{ bsw@1261: tag = "input", bsw@1261: attr = { bsw@1261: id = "digest_off", bsw@1261: type = "radio", name = "digest", value = "false", bsw@1266: checked = app.session.member.notification_dow == nil and app.session.member.hotification_hour == nil and "checked" or nil bsw@1261: } bsw@1261: } bsw@1261: ui.tag{ bsw@1261: tag = "label", attr = { ['for'] = "digest_off" }, bsw@1261: content = _"Send me only updates on issue phase changes" bsw@1261: } bsw@1261: end } bsw@1255: end } bsw@1255: bsw@1263: slot.put("
") bsw@1255: bsw@1045: ui.container{ content = function() bsw@1045: ui.tag{ bsw@1045: tag = "input", bsw@1045: attr = { bsw@1045: id = "notify_level_none", bsw@1248: type = "radio", name = "disable_notifications", value = "true", bsw@1248: checked = app.session.member.disable_notifications and "checked" or nil bsw@1045: } bsw@1045: } bsw@1045: ui.tag{ bsw@1045: tag = "label", attr = { ['for'] = "notify_level_none" }, bsw@1045: content = _"I do not like to receive notifications by email" bsw@1045: } bsw@1045: end } bsw@1045: bsw@1045: slot.put("
") bsw@1045: bsw@1045: ui.tag{ bsw@1045: tag = "input", bsw@1045: attr = { bsw@1045: type = "submit", bsw@1045: class = "btn btn-default", bsw@1045: value = _"Save" bsw@1045: }, bsw@1045: content = "" bsw@348: } bsw@1045: slot.put("


") bsw@1045: bsw@1045: slot.put(" ") bsw@1045: if return_to == "home" then bsw@1045: ui.link { bsw@1045: module = "index", view = "index", bsw@1045: content = _"cancel" bsw@1045: } bsw@1045: else bsw@1045: ui.link { bsw@1045: module = "member", view = "show", id = app.session.member_id, bsw@1045: content = _"cancel" bsw@1045: } bsw@1045: end bsw@1045: end ) bsw@1045: end ) bsw@474: bsw@286: end bsw@286: } bsw@287: