mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 23:42:12 +00:00
Refactor email notifications
This commit is contained in:
parent
81a05230e7
commit
08c7ca1833
1 changed files with 9 additions and 59 deletions
|
|
@ -272,66 +272,16 @@ script(id='partials/options.settings.notifications.html', type="text/ng-template
|
|||
=env.t('emailNotifications')
|
||||
.panel-body
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.newPM', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.newPM === true', ng-change='set({"preferences.emailNotifications.newPM": user.preferences.emailNotifications.newPM ? true: false})')
|
||||
span=env.t('newPM')
|
||||
each notification in ['newPM', 'wonChallenge', 'giftedGems', 'giftedSubscription', 'invitedParty', 'invitedGuild', 'kickedGroup', 'questStarted', 'invitedQuest', 'inactivityEmails', 'weeklyRecaps']
|
||||
-var preference = 'user.preferences.emailNotifications.' + notification
|
||||
-var unsubscribeFromAll = 'user.preferences.emailNotifications.unsubscribeFromAll'
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.wonChallenge', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.newPM === true', ng-change='set({"preferences.emailNotifications.wonChallenge": user.preferences.emailNotifications.wonChallenge ? true: false})')
|
||||
span=env.t('wonChallenge')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.giftedGems', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.giftedGems === true', ng-change='set({"preferences.emailNotifications.giftedGems": user.preferences.emailNotifications.giftedGems ? true: false})')
|
||||
span=env.t('giftedGems')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.giftedSubscription', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.giftedSubscription === true', ng-change='set({"preferences.emailNotifications.giftedSubscription": user.preferences.emailNotifications.giftedSubscription ? true: false})')
|
||||
span=env.t('giftedSubscription')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.invitedParty', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.invitedParty === true', ng-change='set({"preferences.emailNotifications.invitedParty": user.preferences.emailNotifications.invitedParty ? true: false})')
|
||||
span=env.t('invitedParty')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.invitedGuild', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.invitedGuild === true', ng-change='set({"preferences.emailNotifications.invitedGuild": user.preferences.emailNotifications.invitedGuild ? true: false})')
|
||||
span=env.t('invitedGuild')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.kickedGroup', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.kickedGroup === true', ng-change='set({"preferences.emailNotifications.kickedGroup": user.preferences.emailNotifications.kickedGroup ? true: false})')
|
||||
span=env.t('kickedGroup')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.questStarted', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.questStarted === true', ng-change='set({"preferences.emailNotifications.questStarted": user.preferences.emailNotifications.questStarted ? true: false})')
|
||||
span=env.t('questStarted')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.invitedQuest', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.invitedQuest === true', ng-change='set({"preferences.emailNotifications.invitedQuest": user.preferences.emailNotifications.invitedQuest ? true: false})')
|
||||
span=env.t('invitedQuest')
|
||||
|
||||
//.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.remindersToLogin', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.remindersToLogin === true', ng-change='set({"preferences.emailNotifications.remindersToLogin": user.preferences.emailNotifications.remindersToLogin ? true: false})')
|
||||
span=env.t('remindersToLogin')
|
||||
|
||||
// These are the recapture emails, important announcements was the previous name used for them
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.importantAnnouncements', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.importantAnnouncements === true', ng-change='set({"preferences.emailNotifications.importantAnnouncements": user.preferences.emailNotifications.importantAnnouncements ? true: false})')
|
||||
span=env.t('inactivityEmails')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.weeklyRecaps', ng-checked='user.preferences.emailNotifications.unsubscribeFromAll === false && user.preferences.emailNotifications.weeklyRecaps === true', ng-change='set({"preferences.emailNotifications.weeklyRecaps": user.preferences.emailNotifications.weeklyRecaps ? true: false})')
|
||||
span=env.t('weeklyRecaps')
|
||||
.checkbox: label
|
||||
input(type='checkbox', ng-model='#{preference}',
|
||||
ng-disabled='#{unsubscribeFromAll} === true',
|
||||
ng-checked='#{unsubscribeFromAll} === false && #{preference} === true',
|
||||
ng-change='set({"preferences.emailNotifications.#{notification}": #{preference} ? true: false})')
|
||||
span=env.t(notification)
|
||||
|
||||
hr
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue