diff --git a/pretalx_broadcast_tools/exporter.py b/pretalx_broadcast_tools/exporter.py index 3eaa4c1..10f9a61 100644 --- a/pretalx_broadcast_tools/exporter.py +++ b/pretalx_broadcast_tools/exporter.py @@ -17,6 +17,8 @@ from reportlab.platypus import ( TableStyle, ) +from .utils.placeholders import placeholders + A4_WIDTH, A4_HEIGHT = A4 PAGE_PADDING = 10 * mm @@ -169,6 +171,17 @@ class PDFInfoPage(Flowable): ) ) + if self.event.settings.broadcast_tools_pdf_additional_content: + self._space() + self._add( + Paragraph( + self.event.settings.broadcast_tools_pdf_additional_content.format( + **placeholders(self.schedule, self.talk) + ), + style=self.style["Meta"], + ) + ) + if self.talk.submission.answers and self._questions: self._space() self._add( diff --git a/pretalx_broadcast_tools/forms.py b/pretalx_broadcast_tools/forms.py index e5cc8fa..aa5eb19 100644 --- a/pretalx_broadcast_tools/forms.py +++ b/pretalx_broadcast_tools/forms.py @@ -1,4 +1,4 @@ -from django.forms import BooleanField, CharField +from django.forms import BooleanField, CharField, Textarea from django.utils.translation import gettext_lazy as _ from hierarkey.forms import HierarkeyForm from i18nfield.forms import I18nFormField, I18nFormMixin, I18nTextInput @@ -14,7 +14,10 @@ class BroadcastToolsSettingsForm(I18nFormMixin, HierarkeyForm): required=True, ) broadcast_tools_lower_thirds_info_string = I18nFormField( - help_text=_("Will only be shown if there's a talk running."), + help_text=_( + "Will only be shown if there's a talk running. You may use " + "the place holders mentioned below." + ), label=_("info line"), required=False, widget=I18nTextInput, @@ -43,3 +46,13 @@ class BroadcastToolsSettingsForm(I18nFormMixin, HierarkeyForm): label=_("Questions to include"), required=False, ) + broadcast_tools_pdf_additional_content = CharField( + help_text=_( + "Additional content to print onto the PDF export. " + "Will get printed as-is. You may use the place holders " + "mentioned below." + ), + label=_("Additional Text"), + required=False, + widget=Textarea, + ) diff --git a/pretalx_broadcast_tools/templates/pretalx_broadcast_tools/orga.html b/pretalx_broadcast_tools/templates/pretalx_broadcast_tools/orga.html index 55d87f0..06d0066 100644 --- a/pretalx_broadcast_tools/templates/pretalx_broadcast_tools/orga.html +++ b/pretalx_broadcast_tools/templates/pretalx_broadcast_tools/orga.html @@ -17,15 +17,6 @@ lower third. If you set it to an empty string, it will automatically hide itself.

-

- pretalx will automatically replace some placeholders in your info - string. - Use {CODE} to embed the talk code (MUX9U3 - for example). You could use this to directly link to the talk - feedback page. - Use {EVENT_SLUG} to get the event slug. - Use {TALK_SLUG} to get the talk slug. -

{% if request.event.rooms %}

{% trans "room list" %}

@@ -43,8 +34,23 @@ {% bootstrap_field form.broadcast_tools_pdf_show_internal_notes layout='event' %} {% bootstrap_field form.broadcast_tools_pdf_ignore_do_not_record layout='event' %} {% bootstrap_field form.broadcast_tools_pdf_questions_to_include layout='event' %} + {% bootstrap_field form.broadcast_tools_pdf_additional_content layout='event' %}
+

+ pretalx will automatically replace some placeholders in your custom + content: +

+
+
{CODE}
+
Use to embed the talk code (MUX9U3 for example).
+ +
{EVENT_SLUG}
+
Use to embed the event slug.
+ +
{TALK_SLUG}
+
Use to embed the talk slug.
+
diff --git a/pretalx_broadcast_tools/utils/placeholders.py b/pretalx_broadcast_tools/utils/placeholders.py new file mode 100644 index 0000000..0009ee7 --- /dev/null +++ b/pretalx_broadcast_tools/utils/placeholders.py @@ -0,0 +1,6 @@ +def placeholders(schedule, talk): + return { + "EVENT_SLUG": str(schedule.event.slug), + "TALK_SLUG": talk.frab_slug, + "CODE": talk.submission.code, + } diff --git a/pretalx_broadcast_tools/views.py b/pretalx_broadcast_tools/views.py index cc32795..2e9e236 100644 --- a/pretalx_broadcast_tools/views.py +++ b/pretalx_broadcast_tools/views.py @@ -9,6 +9,7 @@ from pretalx.common.mixins.views import EventPermissionRequired, PermissionRequi from pretalx.schedule.exporters import ScheduleData from .forms import BroadcastToolsSettingsForm +from .utils.placeholders import placeholders class BroadcastToolsLowerThirdsView(TemplateView): @@ -99,11 +100,7 @@ class BroadcastToolsScheduleView(EventPermissionRequired, ScheduleMixin, Templat if talk.submission.track else None, "room": str(room["name"]), - "infoline": infoline.format( - EVENT_SLUG=str(schedule.event.slug), - TALK_SLUG=talk.frab_slug, - CODE=talk.submission.code, - ), + "infoline": infoline.format(**placeholders(schedule, talk)), } for day in schedule.data for room in day["rooms"]