1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-01 00:25:49 +00:00

add TRACK_NAME and TRACK_NAME_COLOURED placeholders

This commit is contained in:
Franzi 2023-10-10 16:00:24 +02:00
parent 341a9c072c
commit dabc8e5443
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 25 additions and 3 deletions

View file

@ -45,6 +45,9 @@
<dt><code>{TALK_URL}</code></dt>
<dd>URL to the talk detail page.</dd>
<dt><code>{TRACK_NAME}</code> or <code>{TRACK_NAME_COLOURED}</code></dt>
<dd>Track name in plain text or coloured using the track colour.</dd>
</dl>
<fieldset>

View file

@ -1,8 +1,10 @@
from django.conf import settings
def placeholders(schedule, talk):
return {
def placeholders(schedule, talk, supports_html_colour=False):
track_name = str(talk.submission.track.name) if talk.submission.track else ""
result = {
"CODE": talk.submission.code,
"EVENT_SLUG": str(schedule.event.slug),
"FEEDBACK_URL": "{}{}".format(
@ -14,4 +16,17 @@ def placeholders(schedule, talk):
schedule.event.custom_domain or settings.SITE_URL,
talk.submission.urls.public,
),
"TRACK_NAME": track_name,
}
if talk.submission.track and supports_html_colour:
result["TRACK_NAME_COLOURED"] = '<span style="color: {}">{}</span>'.format(
talk.submission.track.color, track_name
)
else:
result["TRACK_NAME_COLOURED"] = track_name
# for the americans
result["TRACK_NAME_COLORED"] = result["TRACK_NAME_COLOURED"]
return result

View file

@ -60,7 +60,11 @@ class BroadcastToolsScheduleView(EventPermissionRequired, ScheduleMixin, View):
if talk.submission.track
else None,
"room": room["name"].localize(schedule.event.locale),
"infoline": infoline.format(**placeholders(schedule, talk)),
"infoline": infoline.format(
**placeholders(
schedule, talk, supports_html_colour=True
)
),
"image_url": talk.submission.image_url,
"locale": talk.submission.content_locale,
"do_not_record": talk.submission.do_not_record,