1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-15 06:45:51 +00:00
pretalx-plugin-broadcast-tools/pretalx_broadcast_tools/signals.py

45 lines
1.4 KiB
Python
Raw Normal View History

from django.dispatch import receiver
from django.urls import resolve, reverse
2023-06-03 21:07:34 +00:00
from django.utils.translation import gettext_lazy as _
2023-08-23 06:11:19 +00:00
from django.utils.translation import gettext_noop
2021-11-21 12:07:19 +00:00
from i18nfield.strings import LazyI18nString
from pretalx.common.models.settings import hierarkey
from pretalx.common.signals import register_data_exporters
from pretalx.orga.signals import nav_event_settings
2021-11-21 12:07:19 +00:00
hierarkey.add_default(
"broadcast_tools_lower_thirds_no_talk_info",
2021-11-21 12:07:19 +00:00
LazyI18nString.from_gettext(
gettext_noop("Sorry, there's currently no talk running")
),
LazyI18nString,
)
hierarkey.add_default("broadcast_tools_lower_thirds_info_string", "", LazyI18nString)
2021-11-21 12:07:19 +00:00
@receiver(nav_event_settings)
def navbar_info(sender, request, **kwargs):
url = resolve(request.path_info)
2021-11-21 07:06:35 +00:00
if not request.user.has_perm("orga.change_settings", request.event):
return []
2021-11-21 07:06:35 +00:00
return [
{
2021-11-22 19:53:07 +00:00
"label": _("broadcast tools"),
2021-11-21 07:06:35 +00:00
"url": reverse(
"plugins:pretalx_broadcast_tools:orga",
2021-11-21 07:06:35 +00:00
kwargs={
"event": request.event.slug,
},
),
"active": url.namespace == "plugins:pretalx_broadcast_tools"
2021-11-21 07:06:35 +00:00
and url.url_name == "orga",
}
]
2022-10-22 20:17:15 +00:00
@receiver(register_data_exporters, dispatch_uid="exporter_broadcast_pdfexporter")
def register_data_exporter(sender, **kwargs):
from .exporter import PDFExporter
return PDFExporter