From 86b061c971c605c00d5fbd33ea48014a0ee1c919 Mon Sep 17 00:00:00 2001 From: badbl0cks <4161747+badbl0cks@users.noreply.github.com> Date: Sun, 13 Apr 2025 21:14:20 -0700 Subject: [PATCH] add email setting, closes #5. other misc small fixes --- accounts/forms.py | 2 +- accounts/migrations/0001_initial.py | 3 +- accounts/models.py | 5 + cards/migrations/0001_initial.py | 2 +- theme/static_src/tailwind.config.js | 4 + theme/templatetags/card_badge.html | 2 +- theme/templatetags/card_multiselect.html | 18 +-- theme/templatetags/trade_acceptance.html | 4 +- theme/templatetags/trade_offer.html | 137 +++++++++++------------ trades/migrations/0001_initial.py | 2 +- trades/signals.py | 5 +- 11 files changed, 85 insertions(+), 99 deletions(-) diff --git a/accounts/forms.py b/accounts/forms.py index 17f00ac..6788d85 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -87,4 +87,4 @@ class CustomUserCreationForm(SignupForm): class UserSettingsForm(forms.ModelForm): class Meta: model = CustomUser - fields = ['show_friend_code_on_link_previews'] \ No newline at end of file + fields = ['show_friend_code_on_link_previews', 'enable_email_notifications'] \ No newline at end of file diff --git a/accounts/migrations/0001_initial.py b/accounts/migrations/0001_initial.py index 44fc0b9..9d87ecd 100644 --- a/accounts/migrations/0001_initial.py +++ b/accounts/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1.2 on 2025-04-13 05:10 +# Generated by Django 5.1.2 on 2025-04-14 04:07 import accounts.models import django.contrib.auth.models @@ -33,6 +33,7 @@ class Migration(migrations.Migration): ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), ('show_friend_code_on_link_previews', models.BooleanField(default=False, help_text='This will primarily affect share link previews on X, Discord, etc.', verbose_name='Show Friend Code on Link Previews')), + ('enable_email_notifications', models.BooleanField(default=True, help_text='Receive new trade notifications via email.', verbose_name='Enable Email Notifications')), ('reputation_score', models.IntegerField(default=0)), ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), diff --git a/accounts/models.py b/accounts/models.py index cff10f5..eb8cbaa 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -17,6 +17,11 @@ class CustomUser(AbstractUser): verbose_name="Show Friend Code on Link Previews", help_text="This will primarily affect share link previews on X, Discord, etc." ) + enable_email_notifications = models.BooleanField( + default=True, + verbose_name="Enable Email Notifications", + help_text="Receive new trade notifications via email." + ) reputation_score = models.IntegerField(default=0) def __str__(self): diff --git a/cards/migrations/0001_initial.py b/cards/migrations/0001_initial.py index 5510967..3761385 100644 --- a/cards/migrations/0001_initial.py +++ b/cards/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1.2 on 2025-04-13 05:10 +# Generated by Django 5.1.2 on 2025-04-14 04:07 import django.db.models.deletion from django.db import migrations, models diff --git a/theme/static_src/tailwind.config.js b/theme/static_src/tailwind.config.js index c5908ab..4dc3e18 100644 --- a/theme/static_src/tailwind.config.js +++ b/theme/static_src/tailwind.config.js @@ -46,6 +46,10 @@ module.exports = { 'alert-success', 'alert-warning', 'alert-error', + 'btn-info', + 'btn-success', + 'btn-warning', + 'btn-error', 'bg-info', 'bg-success', 'bg-warning', diff --git a/theme/templatetags/card_badge.html b/theme/templatetags/card_badge.html index f5ae207..f4c89d7 100644 --- a/theme/templatetags/card_badge.html +++ b/theme/templatetags/card_badge.html @@ -1,4 +1,4 @@ - +
{% if not expanded %}
diff --git a/theme/templatetags/card_multiselect.html b/theme/templatetags/card_multiselect.html index e3034ae..8753601 100644 --- a/theme/templatetags/card_multiselect.html +++ b/theme/templatetags/card_multiselect.html @@ -24,7 +24,6 @@