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@1255: ui.container{ content = function() bsw@1255: ui.tag{ bsw@1255: tag = "input", bsw@1255: attr = { bsw@1255: id = "digest_on", bsw@1255: type = "radio", name = "digest", value = "true", bsw@1255: checked = not app.session.member.digest_dow and "checked" or nil bsw@1255: } bsw@1255: } bsw@1255: ui.tag{ bsw@1255: tag = "label", attr = { ['for'] = "digest_on" }, bsw@1255: content = _"Send me updates on issue phase changes and a regular digest" bsw@1255: } bsw@1255: bsw@1255: ui.tag{ content = _"Day:" } bsw@1255: slot.put(" ") bsw@1255: ui.field.select{ bsw@1255: name = "notification_dow", bsw@1255: foreign_records = { bsw@1255: "daily" = _"daily", bsw@1255: 0 = _"Sunday", bsw@1255: 1 = _"Monday", bsw@1255: 2 = _"Tuesday", bsw@1255: 3 = _"Wednesday", bsw@1255: 4 = _"Thursday", bsw@1255: 5 = _"Friday", bsw@1255: 6 = _"Saturday", bsw@1255: 7 = _"Sunday", bsw@1255: } bsw@1255: } bsw@1255: bsw@1255: slot.put(" ") bsw@1045: bsw@1255: ui.tag{ content = _"Hour:" } bsw@1255: slot.put(" ") bsw@1255: local foreign_records = {} bsw@1255: for i = 0, 23 do bsw@1255: foreign_records[#foreign_records+1] = { bsw@1255: id = i, bsw@1255: name = printf("%02d", i), bsw@1255: } bsw@1255: end bsw@1255: ui.field.select{ bsw@1255: name = "notification_hour", bsw@1255: foreign_records = foreign_records, bsw@1255: foreign_id = "id", bsw@1255: foreign_name = "name" bsw@1255: } bsw@1255: end } bsw@1255: end } bsw@1255: bsw@1255: ui.container{ content = function() bsw@1255: ui.tag{ bsw@1255: tag = "input", bsw@1255: attr = { bsw@1255: id = "digest_off", bsw@1255: type = "radio", name = "digest", value = "false", bsw@1255: checked = not app.session.member.digest_dow and "checked" or nil bsw@1255: } bsw@1255: } bsw@1255: ui.tag{ bsw@1255: tag = "label", attr = { ['for'] = "digest_off" }, bsw@1255: content = _"Send me only updates on issue phase changes" bsw@1255: } bsw@1255: end } bsw@1255: bsw@1255: 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: