liquid_feedback_frontend
view app/main/member/settings_notification.lua @ 1279:ec084cda1be9
Fixed wording for notification setting
| author | bsw | 
|---|---|
| date | Mon Apr 18 06:58:53 2016 +0200 (2016-04-18) | 
| parents | 8e0f30273edb | 
| children | deb01dfd4429 | 
 line source
     1 local return_to = param.get("return_to")
     2 local return_to_area_id param.get("return_to_area_id", atom.integer)
     4 ui.titleMember(_"notification settings")
     6 execute.view {
     7   module = "member", view = "_sidebar_whatcanido", params = {
     8     member = app.session.member
     9   }
    10 }
    12 ui.form{
    13   attr = { class = "vertical" },
    14   module = "member",
    15   action = "update_notify_level",
    16   routing = {
    17     ok = {
    18       mode = "redirect",
    19       module = return_to == "area" and "area" or return_to == "home" and "index" or "member",
    20       view = return_to == "area" and "show" or return_to == "home" and "index" or "show",
    21       id = return_to == "area" and return_to_area_id or return_to ~= "home" and app.session.member_id or nil
    22     }
    23   },
    24   content = function()
    26     ui.section( function()
    28       ui.sectionHead( function()
    29         ui.heading { level = 1, content = _"Do you like to receive updates by email?" }
    30       end )
    33       ui.sectionRow( function()
    35         ui.container{ content = function()
    36           ui.tag{
    37             tag = "input", 
    38             attr = {
    39               id = "notify_level_all",
    40               type = "radio", name = "disable_notifications", value = "false",
    41               checked = not app.session.member.disable_notifications and "checked" or nil
    42             }
    43           }
    44           ui.tag{
    45             tag = "label", attr = { ['for'] = "notify_level_all" },
    46             content = _"I like to receive notifications"
    47           }
    48         end }
    50         slot.put("<br />")
    52         ui.container{ attr = { style = "margin-left: 3em;" }, content = function()
    54           ui.container{ content = _"You will receive status update notification on issue phase changes. Additionally you can subscribe for a regular digest including updates on initiative drafts and new suggestions." }
    55           slot.put("<br />")
    56           ui.container{ content = function()
    57             ui.tag{
    58               tag = "input", 
    59               attr = {
    60                 id = "digest_on",
    61                 type = "radio", name = "digest", value = "true",
    62                 checked = app.session.member.notification_hour ~= nil and "checked" or nil
    63               }
    64             }
    65             ui.tag{
    66               tag = "label", attr = { ['for'] = "digest_on" },
    67               content = _"I want to receive a regular digest. Send the digest at:"
    68             }
    69           end }
    71           ui.container{ attr = { style = "margin-left: 4em;" }, content = function()
    72             ui.tag{ content = _"Day:" }
    73             slot.put(" ")
    74             ui.field.select{
    75               container_attr = { style = "display: inline-block; vertical-align: middle;" },
    76               attr = { style = "width: 10em;" },
    77               name = "notification_dow",
    78               foreign_records = {
    79                 { id = "daily", name = _"daily" },
    80                 { id = 0, name = _"Sunday" },
    81                 { id = 1, name = _"Monday" },
    82                 { id = 2, name = _"Tuesday" },
    83                 { id = 3, name = _"Wednesday" },
    84                 { id = 4, name = _"Thursday" },
    85                 { id = 5, name = _"Friday" },
    86                 { id = 6, name = _"Saturday" }
    87               },
    88               foreign_id = "id",
    89               foreign_name = "name",
    90               value = app.session.member.notification_dow
    91             }
    93             slot.put(" ")
    95             ui.tag{ content = _"Hour:" }
    96             slot.put(" ")
    97             local foreign_records = {}
    98             for i = 0, 23 do
    99               foreign_records[#foreign_records+1] = {
   100                 id = i,
   101                 name = string.format("%02d:00 - %02d:59", i, i),
   102               }
   103             end
   104             ui.field.select{
   105               container_attr = { style = "display: inline-block; vertical-align: middle;" },
   106               attr = { style = "width: 6em;" },
   107               name = "notification_hour",
   108               foreign_records = foreign_records,
   109               foreign_id = "id",
   110               foreign_name = "name",
   111               value = app.session.member.notification_hour
   112             }
   113           end }
   115           ui.container{ content = function()
   116             ui.tag{
   117               tag = "input", 
   118               attr = {
   119                 id = "digest_off",
   120                 type = "radio", name = "digest", value = "false",
   121                 checked = app.session.member.notification_dow == nil and app.session.member.notification_hour == nil and "checked" or nil
   122               }
   123             }
   124             ui.tag{
   125               tag = "label", attr = { ['for'] = "digest_off" },
   126               content = _"Don't send me a digest"
   127             }
   128           end }
   129         end }
   131         slot.put("<br />")
   133         ui.container{ content = function()
   134           ui.tag{
   135             tag = "input", 
   136             attr = {
   137               id = "notify_level_none",
   138               type = "radio", name = "disable_notifications", value = "true",
   139               checked = app.session.member.disable_notifications and "checked" or nil
   140             }
   141           }
   142           ui.tag{
   143             tag = "label", attr = { ['for'] = "notify_level_none" },
   144             content = _"Don't send me notifications by email"
   145           }
   146         end }
   148         slot.put("<br />")
   150         ui.tag{
   151           tag = "input",
   152           attr = {
   153             type = "submit",
   154             class = "btn btn-default",
   155             value = _"Save"
   156           },
   157           content = ""
   158         }
   159         slot.put("<br /><br /><br />")
   161         slot.put(" ")
   162         if return_to == "home" then
   163           ui.link {
   164             module = "index", view = "index",
   165             content = _"cancel"
   166           }
   167         else
   168           ui.link {
   169             module = "member", view = "show", id = app.session.member_id, 
   170             content = _"cancel"
   171           }
   172         end
   173       end ) 
   174     end )
   176   end
   177 }
