From c6864297c30d91eb41cca08c0d4fa49757425cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= <felix@thegcat.net> Date: Thu, 12 Sep 2019 10:50:58 +0200 Subject: [PATCH] Add a hint which questions will be publicly shown --- .../locale/de/LC_MESSAGES/django.po | 13 +++++++++---- pretix_public_registrations/signals.py | 13 ++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/pretix_public_registrations/locale/de/LC_MESSAGES/django.po b/pretix_public_registrations/locale/de/LC_MESSAGES/django.po index 1e9893f..24a1963 100644 --- a/pretix_public_registrations/locale/de/LC_MESSAGES/django.po +++ b/pretix_public_registrations/locale/de/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-09-11 22:48+0200\n" +"POT-Creation-Date: 2019-09-12 10:44+0200\n" "PO-Revision-Date: \n" "Last-Translator: Felix Schäfer\n" "Language-Team: \n" @@ -15,7 +15,6 @@ msgstr "" "X-Poedit-SearchPath-0: .\n" #: __init__.py:13 -#| msgid "Public registration" msgid "Pretix public registrations" msgstr "" @@ -43,10 +42,16 @@ msgstr "Teilnehmername anzeigen" msgid "Show product name" msgstr "Produktname anzeigen" -#: signals.py:38 +#: signals.py:46 msgid "Public registration" msgstr "Öffentliche Anmeldung" -#: signals.py:97 +#: signals.py:49 +#, python-format +msgid "" +"The answers to the following questions will be publicly shown: %(qlist)s" +msgstr "Antworten auf folgende Fragen werden öffentlich angezeigt: %(qlist)s" + +#: signals.py:108 msgid "Public registrations" msgstr "Öffentliche Anmeldungen" diff --git a/pretix_public_registrations/signals.py b/pretix_public_registrations/signals.py index bb07333..0171fbb 100644 --- a/pretix_public_registrations/signals.py +++ b/pretix_public_registrations/signals.py @@ -34,10 +34,21 @@ def add_public_registrations_html_head(sender, request=None, **kwargs): @receiver(question_form_fields, dispatch_uid="public_registration_question") def add_public_registration_question(sender, position, **kwargs): if str(position.item.pk) in sender.settings.get('public_registrations_items'): + public_questions = sender.questions.filter(pk__in=sender.settings.get('public_registrations_questions')) + headers = ( + [_("Product")] if sender.settings.get('public_registrations_show_item_name') else [] + ) + ( + [_("Name")] if sender.settings.get('public_registrations_show_attendee_name') else [] + ) + [ + q.question for q in public_questions + ] return {'public_registrations_public_registration': forms.BooleanField( label=_('Public registration'), required=False, - help_text=sender.settings.get('public_registrations_field_help_text', as_type=LazyI18nString), + help_text=_( + 'The answers to the following questions will be publicly shown: %(qlist)s' + % {'qlist': ", ".join(str(h) for h in headers)} + ), )} else: return {} -- GitLab