</div>
<div class="notificationSettingsState">
<label>
- <input type="checkbox" id="settings_{@$event->eventID}" name="settings[{@$event->eventID}][enabled]" value="1"{if !$settings[$event->eventID][enabled]|empty} checked{/if}>
+ <input type="checkbox" id="settings_{@$event->eventID}" name="settings[{@$event->eventID}][enabled]" class="jsCheckboxNotificationSettingsState" value="1" data-object-id="{@$event->eventID}"{if !$settings[$event->eventID][enabled]|empty} checked{/if}>
<span class="icon icon24 fa-bell green pointer"></span>
<span class="icon icon24 fa-bell-slash red pointer"></span>
</label>
<div class="notificationSettingsEmail">
{if $event->supportsEmailNotification()}
<input type="hidden" id="settings_{$event->eventID}_mailNotificationType" name="settings[{@$event->eventID}][mailNotificationType]" value="{$settings[$event->eventID][mailNotificationType]}">
- <a href="#" class="notificationSettingsEmailType jsTooltip" role="button" title="{lang}wcf.user.notification.mailNotificationType.{@$settings[$event->eventID][mailNotificationType]}{/lang}" data-object-id="{@$event->eventID}">
+ <a href="#" class="notificationSettingsEmailType jsTooltip{if $settings[$event->eventID][enabled]|empty} disabled{/if}" role="button" title="{lang}wcf.user.notification.mailNotificationType.{@$settings[$event->eventID][mailNotificationType]}{/lang}" data-object-id="{@$event->eventID}">
{if $settings[$event->eventID][mailNotificationType] === 'none'}
<span class="icon icon24 fa-times red jsIconNotificationSettingsEmailType"></span>
{else}
* 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
*/