| 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@474
 | 
    32     
 | 
| 
bsw@1045
 | 
    33       ui.sectionRow( function()
 | 
| 
bsw@1045
 | 
    34       
 | 
| 
bsw@1045
 | 
    35         ui.container{ content = function()
 | 
| 
bsw@1045
 | 
    36           ui.tag{
 | 
| 
bsw@1045
 | 
    37             tag = "input", 
 | 
| 
bsw@1045
 | 
    38             attr = {
 | 
| 
bsw@1045
 | 
    39               id = "notify_level_all",
 | 
| 
bsw@1248
 | 
    40               type = "radio", name = "disable_notifications", value = "false",
 | 
| 
bsw@1248
 | 
    41               checked = not app.session.member.disable_notifications and "checked" or nil
 | 
| 
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@1045
 | 
    50         slot.put("<br />")
 | 
| 
bsw@1255
 | 
    51         
 | 
| 
bsw@1255
 | 
    52         ui.container{ content = function()
 | 
| 
bsw@1255
 | 
    53           ui.tag{
 | 
| 
bsw@1255
 | 
    54             tag = "input", 
 | 
| 
bsw@1255
 | 
    55             attr = {
 | 
| 
bsw@1255
 | 
    56               id = "digest_on",
 | 
| 
bsw@1255
 | 
    57               type = "radio", name = "digest", value = "true",
 | 
| 
bsw@1255
 | 
    58               checked = not app.session.member.digest_dow and "checked" or nil
 | 
| 
bsw@1255
 | 
    59             }
 | 
| 
bsw@1255
 | 
    60           }
 | 
| 
bsw@1255
 | 
    61           ui.tag{
 | 
| 
bsw@1255
 | 
    62             tag = "label", attr = { ['for'] = "digest_on" },
 | 
| 
bsw@1255
 | 
    63             content = _"Send me updates on issue phase changes and a regular digest"
 | 
| 
bsw@1255
 | 
    64           }
 | 
| 
bsw@1255
 | 
    65           
 | 
| 
bsw@1255
 | 
    66           ui.tag{ content = _"Day:" }
 | 
| 
bsw@1255
 | 
    67           slot.put(" ")
 | 
| 
bsw@1255
 | 
    68           ui.field.select{
 | 
| 
bsw@1255
 | 
    69             name = "notification_dow",
 | 
| 
bsw@1255
 | 
    70             foreign_records = {
 | 
| 
bsw@1255
 | 
    71               "daily" = _"daily",
 | 
| 
bsw@1255
 | 
    72               0 = _"Sunday",
 | 
| 
bsw@1255
 | 
    73               1 = _"Monday",
 | 
| 
bsw@1255
 | 
    74               2 = _"Tuesday",
 | 
| 
bsw@1255
 | 
    75               3 = _"Wednesday",
 | 
| 
bsw@1255
 | 
    76               4 = _"Thursday",
 | 
| 
bsw@1255
 | 
    77               5 = _"Friday",
 | 
| 
bsw@1255
 | 
    78               6 = _"Saturday",
 | 
| 
bsw@1255
 | 
    79               7 = _"Sunday",
 | 
| 
bsw@1255
 | 
    80             }
 | 
| 
bsw@1255
 | 
    81           }
 | 
| 
bsw@1255
 | 
    82           
 | 
| 
bsw@1255
 | 
    83           slot.put(" ")
 | 
| 
bsw@1045
 | 
    84 
 | 
| 
bsw@1255
 | 
    85           ui.tag{ content = _"Hour:" }
 | 
| 
bsw@1255
 | 
    86             slot.put(" ")
 | 
| 
bsw@1255
 | 
    87             local foreign_records = {}
 | 
| 
bsw@1255
 | 
    88             for i = 0, 23 do
 | 
| 
bsw@1255
 | 
    89               foreign_records[#foreign_records+1] = {
 | 
| 
bsw@1255
 | 
    90                 id = i,
 | 
| 
bsw@1255
 | 
    91                 name = printf("%02d", i),
 | 
| 
bsw@1255
 | 
    92               }
 | 
| 
bsw@1255
 | 
    93             end
 | 
| 
bsw@1255
 | 
    94             ui.field.select{
 | 
| 
bsw@1255
 | 
    95               name = "notification_hour",
 | 
| 
bsw@1255
 | 
    96               foreign_records = foreign_records,
 | 
| 
bsw@1255
 | 
    97               foreign_id = "id",
 | 
| 
bsw@1255
 | 
    98               foreign_name = "name"
 | 
| 
bsw@1255
 | 
    99             }
 | 
| 
bsw@1255
 | 
   100           end }
 | 
| 
bsw@1255
 | 
   101         end }
 | 
| 
bsw@1255
 | 
   102         
 | 
| 
bsw@1255
 | 
   103         ui.container{ content = function()
 | 
| 
bsw@1255
 | 
   104           ui.tag{
 | 
| 
bsw@1255
 | 
   105             tag = "input", 
 | 
| 
bsw@1255
 | 
   106             attr = {
 | 
| 
bsw@1255
 | 
   107               id = "digest_off",
 | 
| 
bsw@1255
 | 
   108               type = "radio", name = "digest", value = "false",
 | 
| 
bsw@1255
 | 
   109               checked = not app.session.member.digest_dow and "checked" or nil
 | 
| 
bsw@1255
 | 
   110             }
 | 
| 
bsw@1255
 | 
   111           }
 | 
| 
bsw@1255
 | 
   112           ui.tag{
 | 
| 
bsw@1255
 | 
   113             tag = "label", attr = { ['for'] = "digest_off" },
 | 
| 
bsw@1255
 | 
   114             content = _"Send me only updates on issue phase changes"
 | 
| 
bsw@1255
 | 
   115           }
 | 
| 
bsw@1255
 | 
   116         end }
 | 
| 
bsw@1255
 | 
   117         
 | 
| 
bsw@1255
 | 
   118         
 | 
| 
bsw@1255
 | 
   119         
 | 
| 
bsw@1045
 | 
   120         ui.container{ content = function()
 | 
| 
bsw@1045
 | 
   121           ui.tag{
 | 
| 
bsw@1045
 | 
   122             tag = "input", 
 | 
| 
bsw@1045
 | 
   123             attr = {
 | 
| 
bsw@1045
 | 
   124               id = "notify_level_none",
 | 
| 
bsw@1248
 | 
   125               type = "radio", name = "disable_notifications", value = "true",
 | 
| 
bsw@1248
 | 
   126               checked = app.session.member.disable_notifications and "checked" or nil
 | 
| 
bsw@1045
 | 
   127             }
 | 
| 
bsw@1045
 | 
   128           }
 | 
| 
bsw@1045
 | 
   129           ui.tag{
 | 
| 
bsw@1045
 | 
   130             tag = "label", attr = { ['for'] = "notify_level_none" },
 | 
| 
bsw@1045
 | 
   131             content = _"I do not like to receive notifications by email"
 | 
| 
bsw@1045
 | 
   132           }
 | 
| 
bsw@1045
 | 
   133         end }
 | 
| 
bsw@1045
 | 
   134         
 | 
| 
bsw@1045
 | 
   135         slot.put("<br />")
 | 
| 
bsw@1045
 | 
   136       
 | 
| 
bsw@1045
 | 
   137         ui.tag{
 | 
| 
bsw@1045
 | 
   138           tag = "input",
 | 
| 
bsw@1045
 | 
   139           attr = {
 | 
| 
bsw@1045
 | 
   140             type = "submit",
 | 
| 
bsw@1045
 | 
   141             class = "btn btn-default",
 | 
| 
bsw@1045
 | 
   142             value = _"Save"
 | 
| 
bsw@1045
 | 
   143           },
 | 
| 
bsw@1045
 | 
   144           content = ""
 | 
| 
bsw@348
 | 
   145         }
 | 
| 
bsw@1045
 | 
   146         slot.put("<br /><br /><br />")
 | 
| 
bsw@1045
 | 
   147         
 | 
| 
bsw@1045
 | 
   148         slot.put(" ")
 | 
| 
bsw@1045
 | 
   149         if return_to == "home" then
 | 
| 
bsw@1045
 | 
   150           ui.link {
 | 
| 
bsw@1045
 | 
   151             module = "index", view = "index",
 | 
| 
bsw@1045
 | 
   152             content = _"cancel"
 | 
| 
bsw@1045
 | 
   153           }
 | 
| 
bsw@1045
 | 
   154         else
 | 
| 
bsw@1045
 | 
   155           ui.link {
 | 
| 
bsw@1045
 | 
   156             module = "member", view = "show", id = app.session.member_id, 
 | 
| 
bsw@1045
 | 
   157             content = _"cancel"
 | 
| 
bsw@1045
 | 
   158           }
 | 
| 
bsw@1045
 | 
   159         end
 | 
| 
bsw@1045
 | 
   160       end ) 
 | 
| 
bsw@1045
 | 
   161     end )
 | 
| 
bsw@474
 | 
   162     
 | 
| 
bsw@286
 | 
   163   end
 | 
| 
bsw@286
 | 
   164 }
 | 
| 
bsw@287
 | 
   165  
 |