| rev | 
   line source | 
| 
bsw@286
 | 
     1 slot.put_into("title", _"Notification settings")
 | 
| 
bsw@286
 | 
     2 
 | 
| 
bsw@286
 | 
     3 slot.select("actions", function()
 | 
| 
bsw@286
 | 
     4   ui.link{
 | 
| 
bsw@286
 | 
     5     content = function()
 | 
| 
bsw@286
 | 
     6         ui.image{ static = "icons/16/cancel.png" }
 | 
| 
bsw@286
 | 
     7         slot.put(_"Cancel")
 | 
| 
bsw@286
 | 
     8     end,
 | 
| 
bsw@286
 | 
     9     module = "member",
 | 
| 
bsw@286
 | 
    10     view = "settings"
 | 
| 
bsw@286
 | 
    11   }
 | 
| 
bsw@286
 | 
    12 end)
 | 
| 
bsw@286
 | 
    13 
 | 
| 
bsw@286
 | 
    14 
 | 
| 
bsw@286
 | 
    15 util.help("member.settings.notification", _"Notification settings")
 | 
| 
bsw@286
 | 
    16 
 | 
| 
bsw@286
 | 
    17 ui.form{
 | 
| 
bsw@286
 | 
    18   attr = { class = "vertical" },
 | 
| 
bsw@286
 | 
    19   module = "member",
 | 
| 
bsw@348
 | 
    20   action = "update_notify_level",
 | 
| 
bsw@286
 | 
    21   routing = {
 | 
| 
bsw@286
 | 
    22     ok = {
 | 
| 
bsw@286
 | 
    23       mode = "redirect",
 | 
| 
bsw@286
 | 
    24       module = "index",
 | 
| 
bsw@286
 | 
    25       view = "index"
 | 
| 
bsw@286
 | 
    26     }
 | 
| 
bsw@286
 | 
    27   },
 | 
| 
bsw@286
 | 
    28   content = function()
 | 
| 
bsw@474
 | 
    29     ui.tag{ tag = "p", content = _"I like to receive notifications about events in my areas and issues:" }
 | 
| 
bsw@286
 | 
    30   
 | 
| 
bsw@286
 | 
    31     ui.container{ content = function()
 | 
| 
bsw@286
 | 
    32       ui.tag{
 | 
| 
bsw@286
 | 
    33         tag = "input", 
 | 
| 
bsw@348
 | 
    34         attr = {
 | 
| 
bsw@474
 | 
    35           id = "notify_level_none",
 | 
| 
bsw@474
 | 
    36           type = "radio", name = "notify_level", value = "none",
 | 
| 
bsw@474
 | 
    37           checked = app.session.member.notify_level == 'none' and "checked" or nil
 | 
| 
bsw@348
 | 
    38         }
 | 
| 
bsw@286
 | 
    39       }
 | 
| 
bsw@474
 | 
    40       ui.tag{
 | 
| 
bsw@474
 | 
    41         tag = "label", attr = { ['for'] = "notify_level_none" },
 | 
| 
bsw@474
 | 
    42         content = _"No notifications at all"
 | 
| 
bsw@474
 | 
    43       }
 | 
| 
bsw@286
 | 
    44     end }
 | 
| 
bsw@474
 | 
    45      
 | 
| 
bsw@474
 | 
    46     slot.put("<br />")
 | 
| 
bsw@474
 | 
    47   
 | 
| 
bsw@286
 | 
    48     ui.container{ content = function()
 | 
| 
bsw@286
 | 
    49       ui.tag{
 | 
| 
bsw@286
 | 
    50         tag = "input", 
 | 
| 
bsw@348
 | 
    51         attr = {
 | 
| 
bsw@474
 | 
    52           id = "notify_level_all",
 | 
| 
bsw@474
 | 
    53           type = "radio", name = "notify_level", value = "all",
 | 
| 
bsw@474
 | 
    54           checked = app.session.member.notify_level == 'all' and "checked" or nil
 | 
| 
bsw@348
 | 
    55         }
 | 
| 
bsw@286
 | 
    56       }
 | 
| 
bsw@474
 | 
    57       ui.tag{
 | 
| 
bsw@474
 | 
    58         tag = "label", attr = { ['for'] = "notify_level_all" },
 | 
| 
bsw@474
 | 
    59         content = _"All of them"
 | 
| 
bsw@474
 | 
    60       }
 | 
| 
bsw@286
 | 
    61     end }
 | 
| 
bsw@474
 | 
    62     
 | 
| 
bsw@474
 | 
    63     slot.put("<br />")
 | 
| 
bsw@286
 | 
    64 
 | 
| 
bsw@286
 | 
    65     ui.container{ content = function()
 | 
| 
bsw@286
 | 
    66       ui.tag{
 | 
| 
bsw@286
 | 
    67         tag = "input", 
 | 
| 
bsw@348
 | 
    68         attr = {
 | 
| 
bsw@474
 | 
    69           id = "notify_level_discussion",
 | 
| 
bsw@348
 | 
    70           type = "radio", name = "notify_level", value = "discussion",
 | 
| 
bsw@348
 | 
    71           checked = app.session.member.notify_level == 'discussion' and "checked" or nil
 | 
| 
bsw@348
 | 
    72         }
 | 
| 
bsw@286
 | 
    73       }
 | 
| 
bsw@474
 | 
    74       ui.tag{
 | 
| 
bsw@474
 | 
    75         tag = "label", attr = { ['for'] = "notify_level_discussion" },
 | 
| 
bsw@474
 | 
    76         content = _"Only for issues reaching the discussion phase"
 | 
| 
bsw@474
 | 
    77       }
 | 
| 
bsw@286
 | 
    78     end }
 | 
| 
bsw@286
 | 
    79 
 | 
| 
bsw@474
 | 
    80     slot.put("<br />")
 | 
| 
bsw@474
 | 
    81 
 | 
| 
bsw@286
 | 
    82     ui.container{ content = function()
 | 
| 
bsw@286
 | 
    83       ui.tag{
 | 
| 
bsw@286
 | 
    84         tag = "input", 
 | 
| 
bsw@348
 | 
    85         attr = {
 | 
| 
bsw@474
 | 
    86           id = "notify_level_verification",
 | 
| 
bsw@474
 | 
    87           type = "radio", name = "notify_level", value = "verification",
 | 
| 
bsw@474
 | 
    88           checked = app.session.member.notify_level == 'verification' and "checked" or nil
 | 
| 
bsw@348
 | 
    89         }
 | 
| 
bsw@286
 | 
    90       }
 | 
| 
bsw@474
 | 
    91       ui.tag{
 | 
| 
bsw@474
 | 
    92         tag = "label", attr = { ['for'] = "notify_level_verification" },
 | 
| 
bsw@474
 | 
    93         content = _"Only for issues reaching the frozen phase"
 | 
| 
bsw@474
 | 
    94       }
 | 
| 
bsw@286
 | 
    95     end }
 | 
| 
bsw@474
 | 
    96     
 | 
| 
bsw@474
 | 
    97     slot.put("<br />")
 | 
| 
bsw@286
 | 
    98 
 | 
| 
bsw@286
 | 
    99     ui.container{ content = function()
 | 
| 
bsw@286
 | 
   100       ui.tag{
 | 
| 
bsw@286
 | 
   101         tag = "input", 
 | 
| 
bsw@348
 | 
   102         attr = {
 | 
| 
bsw@474
 | 
   103           id = "notify_level_voting",
 | 
| 
bsw@474
 | 
   104           type = "radio", name = "notify_level", value = "voting",
 | 
| 
bsw@474
 | 
   105           checked = app.session.member.notify_level == 'voting' and "checked" or nil
 | 
| 
bsw@348
 | 
   106         }
 | 
| 
bsw@286
 | 
   107       }
 | 
| 
bsw@474
 | 
   108       ui.tag{
 | 
| 
bsw@474
 | 
   109         tag = "label", attr = { ['for'] = "notify_level_voting" },
 | 
| 
bsw@474
 | 
   110         content = _"Only for issues reaching the voting phase"
 | 
| 
bsw@474
 | 
   111       }
 | 
| 
bsw@286
 | 
   112     end }
 | 
| 
bsw@286
 | 
   113 
 | 
| 
bsw@474
 | 
   114     slot.put("<br />")
 | 
| 
bsw@286
 | 
   115 
 | 
| 
bsw@348
 | 
   116     ui.submit{ value = _"Change notification settings" }
 | 
| 
bsw@286
 | 
   117   end
 | 
| 
bsw@286
 | 
   118 }
 | 
| 
bsw@287
 | 
   119  
 | 
| 
bsw@286
 | 
   120 -- select event.id, event.occurrence, membership.member_id NOTNULL as membership, interest.member_id NOTNULL as interest, supporter.member_id NOTNULL as supporter, event.event, event.state, issue.id, initiative.name FROM event JOIN issue ON issue.id = event.issue_id LEFT JOIN membership ON membership.area_id = issue.area_id AND membership.member_id = 41 LEFT JOIN interest ON interest.issue_id = issue.id AND interest.member_id = 41 LEFT JOIN initiative ON initiative.id = event.initiative_id LEFT JOIN supporter ON supporter.initiative_id = initiative.id AND supporter.member_id = 41 WHERE (((event.event = 'issue_state_changed' OR event.event = 'initiative_created_in_new_issue') AND membership.member_id NOTNULL OR interest.member_id NOTNULL) OR (event.event = 'initiative_created_in_existing_issue' AND interest.member_id NOTNULL) OR ((event.event = 'initiative_revoked' OR event.event = 'new_draft_created' OR event.event = 'suggestion_created') AND supporter.member_id NOTNULL)) AND event.id > 7000 ORDER by event.id ASC LIMIT 1; |