liquid_feedback_frontend

changeset 1485:2626155efb83

Updated notification settings view for better user experience
author bsw
date Wed Oct 31 12:21:44 2018 +0100 (2018-10-31)
parents c5d3f93df7ed
children 00ce64d26e9e
files app/main/member/_action/update_notify_level.lua app/main/member/settings_notification.lua
line diff
     1.1 --- a/app/main/member/_action/update_notify_level.lua	Mon Oct 29 14:35:37 2018 +0100
     1.2 +++ b/app/main/member/_action/update_notify_level.lua	Wed Oct 31 12:21:44 2018 +0100
     1.3 @@ -1,4 +1,4 @@
     1.4 -local disable_notifications = param.get("disable_notifications") == "true" and true or false
     1.5 +local disable_notifications = param.get("enable_notifications") ~= "true" and true or false
     1.6  
     1.7  if app.session.member.disable_notifications ~= disable_notifications then
     1.8    IgnoredArea:destroy_by_member_id(app.session.member_id)
     1.9 @@ -8,6 +8,7 @@
    1.10  if app.session.member.disable_notifications then
    1.11    app.session.member.notification_dow = nil
    1.12    app.session.member.notification_hour = nil
    1.13 +  
    1.14  else 
    1.15    if param.get("digest") == "true" then
    1.16      local dow = param.get("notification_dow")
     2.1 --- a/app/main/member/settings_notification.lua	Mon Oct 29 14:35:37 2018 +0100
     2.2 +++ b/app/main/member/settings_notification.lua	Wed Oct 31 12:21:44 2018 +0100
     2.3 @@ -26,11 +26,10 @@
     2.4              }
     2.5            },
     2.6            content = function()
     2.7 -
     2.8 -          
     2.9 +            
    2.10              ui.container{ content = function()
    2.11                ui.tag{ tag = "label", attr = {
    2.12 -                  class = "mdl-radio mdl-js-radio mdl-js-ripple-effect",
    2.13 +                  class = "mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect",
    2.14                    ["for"] = "notify_level_all"
    2.15                  },
    2.16                  content = function()
    2.17 @@ -38,13 +37,14 @@
    2.18                      tag = "input",
    2.19                      attr = {
    2.20                        id = "notify_level_all",
    2.21 -                      class = "mdl-radio__button",
    2.22 -                      type = "radio", name = "disable_notifications", value = "false",
    2.23 +                      class = "mdl-checkbox__input",
    2.24 +                      type = "checkbox", name = "enable_notifications", value = "true",
    2.25                        checked = not app.session.member.disable_notifications and "checked" or nil,
    2.26 +                      onchange = [[ display = document.getElementById("view_on_notify_level_all_false").style.display = this.checked ? "block" : "none"; ]]
    2.27                      }
    2.28                    }
    2.29                    ui.tag{
    2.30 -                    attr = { class = "mdl-radio__label", ['for'] = "notify_level_all" },
    2.31 +                    attr = { class = "mdl-checkbox__label", ['for'] = "notify_level_all" },
    2.32                      content = _"I like to receive notifications"
    2.33                    }
    2.34                  end
    2.35 @@ -52,14 +52,14 @@
    2.36              end }
    2.37              
    2.38              
    2.39 -            ui.container{ attr = { class = "view_on_notify_level_all_false", style = "margin-left: 3em;" }, content = function()
    2.40 +            ui.container{ attr = { id = "view_on_notify_level_all_false" }, content = function()
    2.41                slot.put("<br />")
    2.42              
    2.43                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." }
    2.44                slot.put("<br />")
    2.45                ui.container{ content = function()
    2.46                  ui.tag{ tag = "label", attr = {
    2.47 -                    class = "mdl-radio mdl-js-radio mdl-js-ripple-effect",
    2.48 +                    class = "mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect",
    2.49                      ["for"] = "digest_on"
    2.50                    },
    2.51                    content = function()
    2.52 @@ -67,20 +67,21 @@
    2.53                        tag = "input", 
    2.54                        attr = {
    2.55                          id = "digest_on",
    2.56 -                        class = "mdl-radio__button",
    2.57 -                        type = "radio", name = "digest", value = "true",
    2.58 -                        checked = (app.session.member.disable_notifications or app.session.member.notification_hour ~= nil) and "checked" or nil,
    2.59 +                        class = "mdl-checkbox__input",
    2.60 +                        type = "checkbox", name = "digest", value = "true",
    2.61 +                        checked = app.session.member.notification_hour ~= nil and "checked" or nil,
    2.62 +                        onchange = [[ display = document.getElementById("view_on_digest_true").style.display = this.checked ? "block" : "none"; ]]
    2.63                        }
    2.64                      }
    2.65                      ui.tag{
    2.66 -                      attr = { class = "mdl-radio__label", ['for'] = "digest_on" },
    2.67 +                      attr = { class = "mdl-checkbox__label", ['for'] = "digest_on" },
    2.68                        content = _"I want to receive a regular digest"
    2.69                      }
    2.70                    end
    2.71                  }
    2.72                end }
    2.73            
    2.74 -              ui.container{ attr = { class = "view_on_digest_true", style = "margin-left: 4em;" }, content = function()
    2.75 +              ui.container{ attr = { id = "view_on_digest_true", style = "margin-left: 4em;" }, content = function()
    2.76  
    2.77                  ui.tag{ content = _"every" }
    2.78                  slot.put(" ")
    2.79 @@ -128,56 +129,19 @@
    2.80                    value = random_hour or app.session.member.notification_hour
    2.81                  }
    2.82                end }
    2.83 -              
    2.84 -              ui.container{ content = function()
    2.85 -                ui.tag{ tag = "label", attr = {
    2.86 -                    class = "mdl-radio mdl-js-radio mdl-js-ripple-effect",
    2.87 -                    ["for"] = "digest_off"
    2.88 -                  },
    2.89 -                  content = function()
    2.90 -                    ui.tag{
    2.91 -                      tag = "input", 
    2.92 -                      attr = {
    2.93 -                        id = "digest_off",
    2.94 -                        class = "mdl-radio__button",
    2.95 -                        type = "radio", name = "digest", value = "false",
    2.96 -                        checked = not app.session.member.disable_notifications and app.session.member.notification_dow == nil and app.session.member.notification_hour == nil and "checked" or nil,
    2.97 -                      }
    2.98 -                    }
    2.99 -                    ui.tag{
   2.100 -                      tag = "label", attr = { class = "mdl-radio__label", ['for'] = "digest_off" },
   2.101 -                      content = _"don't send me a digest"
   2.102 -                    }
   2.103 -                  end
   2.104 -                }
   2.105 -              end }
   2.106 +
   2.107              end }
   2.108              
   2.109              slot.put("<br />")
   2.110              
   2.111 -            ui.container{ content = function()
   2.112 -              ui.tag{ tag = "label", attr = {
   2.113 -                  class = "mdl-radio mdl-js-radio mdl-js-ripple-effect",
   2.114 -                  ["for"] = "notify_level_none"
   2.115 -                },
   2.116 -                content = function()
   2.117 -                  ui.tag{
   2.118 -                    tag = "input", 
   2.119 -                    attr = {
   2.120 -                      id = "notify_level_none",
   2.121 -                      class = "mdl-radio__button",
   2.122 -                      type = "radio", name = "disable_notifications", value = "true",
   2.123 -                      checked = app.session.member.disable_notifications and "checked" or nil
   2.124 -                    }
   2.125 -                  }
   2.126 -                  ui.tag{
   2.127 -                    attr = { class = "mdl-radio__label", ['for'] = "notify_level_none" },
   2.128 -                    content = _"don't send me notifications by email"
   2.129 -                  }
   2.130 -                end
   2.131 -              }
   2.132 -            end }
   2.133 +            if app.session.member.disable_notifications then
   2.134 +              ui.script{ script = [[ document.getElementById("view_on_notify_level_all_false").style.display = "none"; ]] }
   2.135 +            end
   2.136              
   2.137 +            if app.session.member.notification_hour == nil  then
   2.138 +              ui.script{ script = [[ document.getElementById("view_on_digest_true").style.display = "none"; ]] }
   2.139 +            end
   2.140 +   
   2.141              slot.put("<br />")
   2.142            
   2.143              ui.tag{

Impressum / About Us