From 38dda0c888381409246cca62e40a4fd5003ebdc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Kol=C3=A1=C5=99?= Date: Sun, 19 Nov 2023 18:08:21 +0100 Subject: [PATCH] feat(pickup): tweaked forms labels & help texts --- fiesta/apps/buddy_system/forms.py | 12 +++++-- fiesta/apps/buddy_system/views/request.py | 3 ++ fiesta/apps/fiestarequests/forms/editor.py | 2 ++ fiesta/apps/fiestarequests/forms/request.py | 3 +- fiesta/apps/pickup_system/forms.py | 31 ++++++++++++++----- .../parts/pickup_request_note_help.html | 9 ++++-- .../parts/pickup_request_place_help.html | 9 ++++++ fiesta/apps/pickup_system/views/request.py | 3 ++ 8 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 fiesta/apps/pickup_system/templates/pickup_system/parts/pickup_request_place_help.html diff --git a/fiesta/apps/buddy_system/forms.py b/fiesta/apps/buddy_system/forms.py index e810d525..1332c4d3 100644 --- a/fiesta/apps/buddy_system/forms.py +++ b/fiesta/apps/buddy_system/forms.py @@ -21,6 +21,12 @@ class NewBuddyRequestForm(BaseNewRequestForm): submit_text = _("Send request for buddy") + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # labels somehow do not work + self.fields["approving_request"].label = _("Are you sure you want to place a buddy request?") + class Meta(BaseNewRequestForm.Meta): model = BuddyRequest @@ -81,9 +87,9 @@ class Meta(BaseRequestMatchForm.Meta): attrs={ "rows": 3, "placeholder": _( - "Hi! I am John and I will be your buddy! " - "The best for communication for me is Telegram, but I am basically on all the social platforms. " - "Looking forward to see your and grab a drink together!" + "Hi! I am John and I will be your buddy! The best for communication for me is Telegram, but I" + " am basically on all the social platforms. Looking forward to see your and grab a drink" + " together!" ), } ) diff --git a/fiesta/apps/buddy_system/views/request.py b/fiesta/apps/buddy_system/views/request.py index 4eeb7133..274b488d 100644 --- a/fiesta/apps/buddy_system/views/request.py +++ b/fiesta/apps/buddy_system/views/request.py @@ -17,6 +17,7 @@ from apps.plugins.views import PluginConfigurationViewMixin from apps.sections.models import SectionMembership, SectionsConfiguration from apps.sections.views.mixins.section_space import EnsureInSectionSpaceViewMixin +from apps.utils.breadcrumbs import with_breadcrumb, with_plugin_home_breadcrumb class BuddySystemEntrance(EnsureInSectionSpaceViewMixin, PluginConfigurationViewMixin, TemplateView): @@ -92,6 +93,8 @@ def form_valid(self, form): return response +@with_plugin_home_breadcrumb +@with_breadcrumb(_("New buddy request")) class NewBuddyRequestView(BaseNewRequestView): form_class = NewBuddyRequestForm success_message = _("Your buddy request has been successfully created!") diff --git a/fiesta/apps/fiestarequests/forms/editor.py b/fiesta/apps/fiestarequests/forms/editor.py index 7908ddd8..56034610 100644 --- a/fiesta/apps/fiestarequests/forms/editor.py +++ b/fiesta/apps/fiestarequests/forms/editor.py @@ -1,6 +1,7 @@ from __future__ import annotations from django.core.exceptions import ValidationError +from django.forms import Textarea from django.utils.translation import gettext_lazy as _ from apps.accounts.models import User @@ -29,6 +30,7 @@ class Meta: field_classes = {} widgets = { "issuer": UserWidget, + "note": Textarea(attrs={"rows": 5}), } diff --git a/fiesta/apps/fiestarequests/forms/request.py b/fiesta/apps/fiestarequests/forms/request.py index e2300b13..7517a0a5 100644 --- a/fiesta/apps/fiestarequests/forms/request.py +++ b/fiesta/apps/fiestarequests/forms/request.py @@ -1,6 +1,6 @@ from __future__ import annotations -from django.forms import BooleanField, fields_for_model +from django.forms import BooleanField, Textarea, fields_for_model from django.utils.translation import gettext_lazy as _ from apps.accounts.models import UserProfile @@ -29,6 +29,7 @@ class Meta: field_classes = {} widgets = { "issuer_faculty": FacultyWidget, + "note": Textarea(attrs={"rows": 5}), } labels = { "note": _("Tell us about yourself"), diff --git a/fiesta/apps/pickup_system/forms.py b/fiesta/apps/pickup_system/forms.py index 1c9579d9..fe9045fa 100644 --- a/fiesta/apps/pickup_system/forms.py +++ b/fiesta/apps/pickup_system/forms.py @@ -36,19 +36,32 @@ class Meta(BaseNewRequestForm.Meta): + () ) field_classes = BaseNewRequestForm.Meta.field_classes | {"time": DateTimeLocalField} - widgets = BaseNewRequestForm.Meta.widgets | {} + widgets = BaseNewRequestForm.Meta.widgets | { + "note": Textarea( + attrs={ + "rows": 5, + "placeholder": _( + "I'll come with a flight W94498 with arrival at 12:30. I'll have two bags and I can handle it " + "by myself, but I'm unsure about the final part of the way to the dormitory." + ), + } + ), + } labels = BaseNewRequestForm.Meta.labels | { - "note": _("Tell me details TODO"), - "interests": _("What are you into?"), - "approving_request": _("I really want a pickup"), "place": _("Where do you want to be picked up?"), "location": _("Place marker as accurately as possible"), + "note": _("Tell us about your arrival"), + "approving_request": _("I really want a pickup"), } help_texts = BaseNewRequestForm.Meta.help_texts | { + "place": lazy( + lambda: render_to_string("pickup_system/parts/pickup_request_place_help.html"), + str, + ), "note": lazy( lambda: render_to_string("pickup_system/parts/pickup_request_note_help.html"), str, - ) + ), } @@ -61,6 +74,9 @@ class PickupRequestEditorForm(WebpackMediaFormMixin, BaseRequestEditorForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + # labels somehow do not work + self.fields["approving_request"].label = _("Are you sure you want to place a pickup request?") + class Meta(BaseRequestEditorForm.Meta): model = PickupRequest fields = BaseRequestEditorForm.Meta.fields + ( @@ -96,9 +112,8 @@ class Meta(BaseRequestMatchForm.Meta): attrs={ "rows": 3, "placeholder": _( - "Hi! I am John and I will pick you up! " - "The best for communication for me is Telegram, but I am basically on all the social platforms. " - "Looking forward to see your and grab a drink together!" + "Hi! I am John and I will pick you up! The best for communication for me is Telegram, but I am" + " basically on all the social platforms. Looking forward to see your and grab a drink together!" ), } ) diff --git a/fiesta/apps/pickup_system/templates/pickup_system/parts/pickup_request_note_help.html b/fiesta/apps/pickup_system/templates/pickup_system/parts/pickup_request_note_help.html index ecd1f313..05cb2b28 100644 --- a/fiesta/apps/pickup_system/templates/pickup_system/parts/pickup_request_note_help.html +++ b/fiesta/apps/pickup_system/templates/pickup_system/parts/pickup_request_note_help.html @@ -1,6 +1,9 @@ -
-

What to include to the requests?

+
+

What to include to the request?

    -
  • You have any specific sign, so our member can recognize you?
  • +
  • If you know already, include details about your last train/bus/airplane connection.
  • +
  • + If possible, mention any details that can help the matcher recognize you, such as the color of your clothing or any distinctive accessories. +
diff --git a/fiesta/apps/pickup_system/templates/pickup_system/parts/pickup_request_place_help.html b/fiesta/apps/pickup_system/templates/pickup_system/parts/pickup_request_place_help.html new file mode 100644 index 00000000..75e4522f --- /dev/null +++ b/fiesta/apps/pickup_system/templates/pickup_system/parts/pickup_request_place_help.html @@ -0,0 +1,9 @@ +
+

What place is expected here?

+
    +
  • Consider the distance between pickup place and your final mobility destination.
  • +
  • Members are volunteers and do pickups in free time – be wise how distant place you'll pick for your pickup.
  • +
  • Completely fine is to arrive at the closest transportation hub, e.g. local airport, train or bus station.
  • +
  • If you have any doubts about final transportation choices, mention them. Our member will assist you.
  • +
+
diff --git a/fiesta/apps/pickup_system/views/request.py b/fiesta/apps/pickup_system/views/request.py index c768c632..5f9e789b 100644 --- a/fiesta/apps/pickup_system/views/request.py +++ b/fiesta/apps/pickup_system/views/request.py @@ -10,6 +10,7 @@ from apps.pickup_system.models import PickupSystemConfiguration from apps.plugins.views import PluginConfigurationViewMixin from apps.sections.views.mixins.section_space import EnsureInSectionSpaceViewMixin +from apps.utils.breadcrumbs import with_breadcrumb, with_plugin_home_breadcrumb class PickupSystemEntrance(EnsureInSectionSpaceViewMixin, PluginConfigurationViewMixin, TemplateView): @@ -24,6 +25,8 @@ def get(self, request, *args, **kwargs): return HttpResponseRedirect(reverse("pickup_system:index")) +@with_plugin_home_breadcrumb +@with_breadcrumb(_("New pickup request")) class NewPickupRequestView(BaseNewRequestView): form_class = NewPickupRequestForm success_message = _("Your pickup request has been successfully created!")