1
0
Fork 0
mirror of https://github.com/MatomoCamp/pretalx-matomocamp.git synced 2024-09-19 15:53:48 +02:00

add buttons to detail page

This commit is contained in:
Lukas Winkler 2021-10-14 14:03:00 +02:00
parent cf0824b8b2
commit d78f4fc0a9
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -1,20 +1,35 @@
# Register your receivers here
from django.dispatch import receiver
from pretalx.agenda.recording import BaseRecordingProvider
from pretalx.agenda.signals import register_recording_provider
from pretalx.cfp.signals import html_head
from pretalx.submission.models import Submission
class MatomoVideoProvider(BaseRecordingProvider):
def get_recording(self, submission):
print(submission)
"""
a bit of a hack to add buttons linking to livestream and chat to the details page
"""
def get_recording(self, submission: Submission):
is_workshop = submission.submission_type.name == "Workshops"
button_title = "View Workshop" if is_workshop else "View Livestream"
livestream_url = f"https://live.matomocamp.org/" + submission.code
chat_url = livestream_url + "/chat_room"
return {
"iframe": '<div class="embed-responsive embed-responsive-16by9"><iframe src="https://example.com"></iframe></div>',
"csp_header": ""}
"iframe": f"""
<div>
<a href='{livestream_url}' class='btn btn-primary'>{button_title}</a>
<a href="{chat_url}" class="btn btn-primary">Join Chatroom</a>
</div>
""",
}
# @receiver(register_recording_provider)
# def matomo_video_provider(sender, **kwargs):
# return MatomoVideoProvider(sender)
@receiver(register_recording_provider)
def matomo_video_provider(sender, **kwargs):
return MatomoVideoProvider(sender)
@receiver(html_head)
def append_to_header(sender, **kwargs):