From ada194122d1e423ddfd130eebeeaac7b92b94dac Mon Sep 17 00:00:00 2001 From: moanos Date: Sun, 25 May 2025 00:10:47 +0200 Subject: [PATCH] refactor(bulma): convert all account related templates --- src/fellchensammlung/forms.py | 11 ++--- .../django_registration/activate.html | 4 +- .../activation_complete.html | 2 +- .../activation_failed.html | 2 +- .../django_registration/activation_form.html | 4 +- .../registration_closed.html | 4 +- .../registration_complete.html | 4 +- .../registration_form.html | 5 ++- src/templates/registration/logged_out.html | 6 +-- src/templates/registration/login.html | 42 ++++++++++++------- .../registration/password_reset_complete.html | 6 +-- .../password_reset_confirmation.html | 4 +- .../registration/password_reset_done.html | 2 +- .../registration/password_reset_form.html | 10 ++--- 14 files changed, 57 insertions(+), 49 deletions(-) diff --git a/src/fellchensammlung/forms.py b/src/fellchensammlung/forms.py index a922992..c226e2d 100644 --- a/src/fellchensammlung/forms.py +++ b/src/fellchensammlung/forms.py @@ -187,20 +187,15 @@ class ModerationActionForm(forms.ModelForm): class CustomRegistrationForm(RegistrationForm): + class Meta(RegistrationForm.Meta): model = User + template_name = "fellchensammlung/forms/form_snippets.html" + captcha = forms.CharField(validators=[animal_validator], label=_("Nenne eine bekannte Tierart"), help_text=_( "Bitte nenne hier eine bekannte Tierart (z.B. ein Tier das an der Leine geführt wird). Das Fragen wir dich um sicherzustellen, dass du kein Roboter bist.")) - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.helper = FormHelper() - self.helper.form_id = 'form-registration' - self.helper.form_class = 'card' - - self.helper.add_input(Submit('submit', _('Registrieren'), css_class="btn")) - class AdoptionNoticeSearchForm(forms.Form): template_name = "fellchensammlung/forms/form_snippets.html" diff --git a/src/templates/django_registration/activate.html b/src/templates/django_registration/activate.html index a0af8f1..f6332a7 100644 --- a/src/templates/django_registration/activate.html +++ b/src/templates/django_registration/activate.html @@ -1,8 +1,8 @@ -{% extends "fellchensammlung/base.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} -

{% translate "Account aktivierung fehlgeschlagen" %}

+

{% translate "Account aktivierung fehlgeschlagen" %}

{% endblock %} \ No newline at end of file diff --git a/src/templates/django_registration/activation_complete.html b/src/templates/django_registration/activation_complete.html index 5f7e026..f8e19cd 100644 --- a/src/templates/django_registration/activation_complete.html +++ b/src/templates/django_registration/activation_complete.html @@ -1,4 +1,4 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} diff --git a/src/templates/django_registration/activation_failed.html b/src/templates/django_registration/activation_failed.html index fdbc95a..cd7f85a 100644 --- a/src/templates/django_registration/activation_failed.html +++ b/src/templates/django_registration/activation_failed.html @@ -2,5 +2,5 @@ {% load i18n %} {% block content %} -

{% translate "Aktivierung fehlgeschlagen. Sende eine E-Mail an info@notfellchen.org für einen Account." %}

+

{% translate "Aktivierung fehlgeschlagen. Sende eine E-Mail an info@notfellchen.org für einen Account." %}

{% endblock %} \ No newline at end of file diff --git a/src/templates/django_registration/activation_form.html b/src/templates/django_registration/activation_form.html index dc99097..d5d797c 100644 --- a/src/templates/django_registration/activation_form.html +++ b/src/templates/django_registration/activation_form.html @@ -3,12 +3,12 @@ {% load crispy_forms_tags %} {% block content %} -
+
{% if not user.is_authenticated %}
{% csrf_token %} {{ form.as_p }} - +
{% else %}

{% translate "Du bist bereits eingeloggt." %}

diff --git a/src/templates/django_registration/registration_closed.html b/src/templates/django_registration/registration_closed.html index 9884838..84ef0fd 100644 --- a/src/templates/django_registration/registration_closed.html +++ b/src/templates/django_registration/registration_closed.html @@ -1,6 +1,6 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} -

{% translate "Registrierung ist fehlgeschlagen." %}

+

{% translate "Registrierung ist fehlgeschlagen." %}

{% endblock %} \ No newline at end of file diff --git a/src/templates/django_registration/registration_complete.html b/src/templates/django_registration/registration_complete.html index d6adc6b..2f9eb87 100644 --- a/src/templates/django_registration/registration_complete.html +++ b/src/templates/django_registration/registration_complete.html @@ -1,8 +1,8 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} -

+

{% blocktranslate %} Du bist nun registriert und hast eine E-Mail mit einem Link zur Aktivierung deines Kontos bekommen. Solltest du die E-Mail nicht erhalten haben oder andere Fragen haben, schreib uns an info@notfellchen.org diff --git a/src/templates/django_registration/registration_form.html b/src/templates/django_registration/registration_form.html index 0052ac7..729aece 100644 --- a/src/templates/django_registration/registration_form.html +++ b/src/templates/django_registration/registration_form.html @@ -1,10 +1,11 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% load crispy_forms_tags %} {% block content %} {% if not user.is_authenticated %} - {% crispy form %} + {{ form }} + {% else %}

{% translate "Du bist bereits eingeloggt." %}

{% endif %} diff --git a/src/templates/registration/logged_out.html b/src/templates/registration/logged_out.html index a18556c..5a05da2 100644 --- a/src/templates/registration/logged_out.html +++ b/src/templates/registration/logged_out.html @@ -1,7 +1,7 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} -

{% translate "Ausloggen" %}!

- {% translate "Hier klicken um die wieder einzuloggen." %} +

{% translate "Ausgeloggt" %}!

+ {% translate "Hier klicken um die wieder einzuloggen." %} {% endblock %} diff --git a/src/templates/registration/login.html b/src/templates/registration/login.html index f578209..cd6f8f4 100644 --- a/src/templates/registration/login.html +++ b/src/templates/registration/login.html @@ -1,33 +1,45 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} {% if form.errors %} -

{% translate "Dein Username oder Passwort ist falsch." %}

+
+ +

+ {% translate "Der eingegebene Username oder das Passwort ist falsch." %} +

+
{% endif %} {% if user.is_authenticated %} -

{% translate "Du bist bereits eingeloggt." %}

+

{% translate "Du bist bereits eingeloggt." %}

{% else %} {% if next %} -

{% translate "Bitte log dich ein um diese Seite sehen zu können." %}

+ +
+ +

+ {% translate "Bitte log dich ein um diese Seite sehen zu können." %} +

+
{% endif %} {% endif %} {% if not user.is_authenticated %} -
-
-
- {% csrf_token %} - {{ form.as_p }} - - -
+
+
+
+ {% csrf_token %} + {{ form }} + + +
- {% endif %} diff --git a/src/templates/registration/password_reset_complete.html b/src/templates/registration/password_reset_complete.html index 0d47763..7fac36f 100644 --- a/src/templates/registration/password_reset_complete.html +++ b/src/templates/registration/password_reset_complete.html @@ -1,7 +1,7 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} -

{% translate "Dein Passwort wurde erfolgreich geändert!" %}

-

{% trans "Wieder einloggen?" %}?

+

{% translate "Dein Passwort wurde erfolgreich geändert!" %}

+

{% trans "Wieder einloggen?" %}?

{% endblock %} diff --git a/src/templates/registration/password_reset_confirmation.html b/src/templates/registration/password_reset_confirmation.html index 4f627ce..e822c4e 100644 --- a/src/templates/registration/password_reset_confirmation.html +++ b/src/templates/registration/password_reset_confirmation.html @@ -1,4 +1,4 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} @@ -24,7 +24,7 @@ {% else %} -

{% translate "Zurücksetzen vom Passwort fehlgeschlagen" %}

+

{% translate "Zurücksetzen vom Passwort fehlgeschlagen" %}

{% translate "Der Link zum Zurücksetzen vom Passwort ist ungültig, vielleicht weil er bereits benutzt wurde. Bitte beantrage die Zurücksetzung erneut." %}

{% endif %} {% endblock %} diff --git a/src/templates/registration/password_reset_done.html b/src/templates/registration/password_reset_done.html index ed2d6ca..f2e0e35 100644 --- a/src/templates/registration/password_reset_done.html +++ b/src/templates/registration/password_reset_done.html @@ -1,4 +1,4 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} diff --git a/src/templates/registration/password_reset_form.html b/src/templates/registration/password_reset_form.html index fe41b80..21f5065 100644 --- a/src/templates/registration/password_reset_form.html +++ b/src/templates/registration/password_reset_form.html @@ -1,15 +1,15 @@ -{% extends "fellchensammlung/base_generic.html" %} +{% extends "fellchensammlung/base_bulma.html" %} {% load i18n %} {% block content %} -
+ {% csrf_token %} {% if form.email.errors %} {{ form.email.errors }} {% endif %} -

{% translate "Passwort zurücksetzen" %}

+

{% translate "Passwort zurücksetzen" %}

{% translate "Bitte gib die E-Mail ein die mit deinem Account verknüpft ist." %}

-

{{ form.email }}

- +

{{ form }}

+
{% endblock %}