bsw@1045: local return_to = param.get("return_to")
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@1045:       module = return_to == "home" and "index" or "member",
bsw@1045:       view = return_to == "home" and "index" or "show",
bsw@1045:       id = 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@1045:         ui.heading { level = 1, content = _"For which issue phases do you like to receive notification emails?" }
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@1045:               type = "radio", name = "notify_level", value = "all",
bsw@1045:               checked = app.session.member.notify_level == 'all' 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@1045: 
bsw@1045:         ui.container{ content = function()
bsw@1045:           ui.tag{
bsw@1045:             tag = "input", 
bsw@1045:             attr = {
bsw@1045:               id = "notify_level_discussion",
bsw@1045:               type = "radio", name = "notify_level", value = "discussion",
bsw@1045:               checked = app.session.member.notify_level == 'discussion' and "checked" or nil
bsw@1045:             }
bsw@1045:           }
bsw@1045:           ui.tag{
bsw@1045:             tag = "label", attr = { ['for'] = "notify_level_discussion" },
bsw@1045:             content = _"Only for issues reaching the discussion phase"
bsw@1045:           }
bsw@1045:         end }
bsw@1045: 
bsw@1045:         slot.put("
")
bsw@286: 
bsw@1045:         ui.container{ content = function()
bsw@1045:           ui.tag{
bsw@1045:             tag = "input", 
bsw@1045:             attr = {
bsw@1045:               id = "notify_level_verification",
bsw@1045:               type = "radio", name = "notify_level", value = "verification",
bsw@1045:               checked = app.session.member.notify_level == 'verification' and "checked" or nil
bsw@1045:             }
bsw@1045:           }
bsw@1045:           ui.tag{
bsw@1045:             tag = "label", attr = { ['for'] = "notify_level_verification" },
bsw@1045:             content = _"Only for issues reaching the verification phase"
bsw@1045:           }
bsw@1045:         end }
bsw@1045:         
bsw@1045:         slot.put("
")
bsw@1045: 
bsw@1045:         ui.container{ content = function()
bsw@1045:           ui.tag{
bsw@1045:             tag = "input", 
bsw@1045:             attr = {
bsw@1045:               id = "notify_level_voting",
bsw@1045:               type = "radio", name = "notify_level", value = "voting",
bsw@1045:               checked = app.session.member.notify_level == 'voting' and "checked" or nil
bsw@1045:             }
bsw@1045:           }
bsw@1045:           ui.tag{
bsw@1045:             tag = "label", attr = { ['for'] = "notify_level_voting" },
bsw@1045:             content = _"Only for issues reaching the voting phase"
bsw@1045:           }
bsw@1045:         end }
bsw@1045: 
bsw@1045:         slot.put("
")
bsw@1045: 
bsw@1045:         ui.container{ content = function()
bsw@1045:           ui.tag{
bsw@1045:             tag = "input", 
bsw@1045:             attr = {
bsw@1045:               id = "notify_level_none",
bsw@1045:               type = "radio", name = "notify_level", value = "none",
bsw@1045:               checked = app.session.member.notify_level == 'none' 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.container { content = _"Notifications are only send to you about events in the subject areas you subscribed, the issues you are interested in and the initiatives you are supporting." }
bsw@1045: 
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: