Skip to content

Commit

Permalink
feat(pickup): tweaked forms labels & help texts
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoeejoee committed Nov 19, 2023
1 parent 9a03a3a commit 38dda0c
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 15 deletions.
12 changes: 9 additions & 3 deletions fiesta/apps/buddy_system/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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!"
),
}
)
Expand Down
3 changes: 3 additions & 0 deletions fiesta/apps/buddy_system/views/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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!")
Expand Down
2 changes: 2 additions & 0 deletions fiesta/apps/fiestarequests/forms/editor.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -29,6 +30,7 @@ class Meta:
field_classes = {}
widgets = {
"issuer": UserWidget,
"note": Textarea(attrs={"rows": 5}),
}


Expand Down
3 changes: 2 additions & 1 deletion fiesta/apps/fiestarequests/forms/request.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -29,6 +29,7 @@ class Meta:
field_classes = {}
widgets = {
"issuer_faculty": FacultyWidget,
"note": Textarea(attrs={"rows": 5}),
}
labels = {
"note": _("Tell us about yourself"),
Expand Down
31 changes: 23 additions & 8 deletions fiesta/apps/pickup_system/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
),
}


Expand All @@ -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 + (
Expand Down Expand Up @@ -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!"
),
}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<div class="prose prose-sm max-w-none">
<h4>What to include to the requests?</h4>
<div class="prose max-w-none">
<h4>What to include to the request?</h4>
<ul>
<li>You have any specific sign, so our member can recognize you?</li>
<li>If you know already, include details about your last train/bus/airplane connection.</li>
<li>
If possible, mention any details that can help the matcher recognize you, such as the color of your clothing or any distinctive accessories.
</li>
</ul>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="prose max-w-none">
<h4>What place is expected here?</h4>
<ul>
<li>Consider the distance between pickup place and your final mobility destination.</li>
<li>Members are volunteers and do pickups in free time – be wise how distant place you'll pick for your pickup.</li>
<li>Completely fine is to arrive at the closest transportation hub, e.g. local airport, train or bus station.</li>
<li>If you have any doubts about final transportation choices, mention them. Our member will assist you.</li>
</ul>
</div>
3 changes: 3 additions & 0 deletions fiesta/apps/pickup_system/views/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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!")
Expand Down

0 comments on commit 38dda0c

Please sign in to comment.