From 8a723bf2b6bc0ffca3f6e3710891684e090e6efd Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 23 Jun 2020 20:32:50 +0200 Subject: [PATCH] Visually disable the email settings for suppressed notifications --- .../templates/notificationSettings.tpl | 4 ++-- .../Core/Controller/User/Notification/Settings.js | 15 +++++++++++++++ wcfsetup/install/files/style/ui/notification.scss | 5 +++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/notificationSettings.tpl b/com.woltlab.wcf/templates/notificationSettings.tpl index e8903824d0..e9e00713c4 100644 --- a/com.woltlab.wcf/templates/notificationSettings.tpl +++ b/com.woltlab.wcf/templates/notificationSettings.tpl @@ -30,7 +30,7 @@
@@ -38,7 +38,7 @@
{if $event->supportsEmailNotification()} - + {if $settings[$event->eventID][mailNotificationType] === 'none'} {else} diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/User/Notification/Settings.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/User/Notification/Settings.js index 2136047031..f97800d102 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/User/Notification/Settings.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/User/Notification/Settings.js @@ -24,11 +24,26 @@ define(['Language', 'Ui/ReusableDropdown'], function (Language, UiReusableDropdo * Binds event listeners for all notifications supporting emails. */ init: function () { + elBySelAll('.jsCheckboxNotificationSettingsState', undefined, (function (checkbox) { + checkbox.addEventListener('change', this._stateChange.bind(this)); + }).bind(this)); + elBySelAll('.notificationSettingsEmailType', undefined, (function (button) { button.addEventListener('click', this._click.bind(this)); }).bind(this)); }, + /** + * @param {Event} event + */ + _stateChange: function (event) { + var objectId = elData(event.currentTarget, 'object-id'); + var emailSettingsType = elBySel('.notificationSettingsEmailType[data-object-id="' + objectId + '"]'); + if (emailSettingsType !== null) { + emailSettingsType.classList[event.currentTarget.checked ? 'remove' : 'add']('disabled'); + } + }, + /** * @param {Event} event event object */ diff --git a/wcfsetup/install/files/style/ui/notification.scss b/wcfsetup/install/files/style/ui/notification.scss index e4060a945c..697774d8fd 100644 --- a/wcfsetup/install/files/style/ui/notification.scss +++ b/wcfsetup/install/files/style/ui/notification.scss @@ -73,4 +73,9 @@ .notificationSettingsEmailType { align-items: center; display: flex; + + &.disabled { + filter: grayscale(1); + opacity: .75; + } } -- 2.20.1