diff --git a/src/pretalx/agenda/templates/agenda/talk.html b/src/pretalx/agenda/templates/agenda/talk.html
index 30675e8bb..2b6c3ff93 100644
--- a/src/pretalx/agenda/templates/agenda/talk.html
+++ b/src/pretalx/agenda/templates/agenda/talk.html
@@ -133,6 +133,11 @@
{% html_signal "pretalx.agenda.signals.html_below_session_pages" sender=request.event request=request submission=submission %}
+ {% if submission_tags %}
+ {% for tag_item in submission_tags %}
+ {{ tag_item.tag }}
+ {% endfor %}
+ {% endif %}
{% if not hide_speaker_links %}
diff --git a/src/pretalx/agenda/views/talk.py b/src/pretalx/agenda/views/talk.py
index e2e1981da..bff8329f7 100644
--- a/src/pretalx/agenda/views/talk.py
+++ b/src/pretalx/agenda/views/talk.py
@@ -53,6 +53,16 @@ def submission(self):
def get_permission_object(self):
return self.submission
+ def get_contrast_color(self, bg_color):
+ if not bg_color:
+ return ''
+ bg_color = bg_color.lstrip('#')
+ r = int(bg_color[0:2], 16)
+ g = int(bg_color[2:4], 16)
+ b = int(bg_color[4:6], 16)
+ brightness = (r * 299 + g * 587 + b * 114) / 1000
+ return 'black' if brightness > 128 else 'white'
+
@cached_property
def recording(self):
for __, response in register_recording_provider.send_robust(self.request.event):
@@ -93,6 +103,9 @@ def get_context_data(self, **kwargs):
.order_by("start")
.select_related("room")
)
+ ctx["submission_tags"] = self.submission.tags.all()
+ for tag_item in ctx['submission_tags']:
+ tag_item.contrast_color = self.get_contrast_color(tag_item.color)
result = []
other_slots = (
schedule.talks.exclude(submission_id=self.submission.pk).filter(
diff --git a/src/pretalx/schedule/models/schedule.py b/src/pretalx/schedule/models/schedule.py
index 1818e0fce..81c3c7c1b 100644
--- a/src/pretalx/schedule/models/schedule.py
+++ b/src/pretalx/schedule/models/schedule.py
@@ -668,7 +668,8 @@ def build_data(self, all_talks=False, filter_updated=None, all_rooms=False):
"updated": talk.updated.isoformat(),
"state": talk.submission.state if all_talks else None,
"fav_count": count_fav_talk(talk.submission.code) if talk.submission else 0,
- "do_not_record": talk.submission.do_not_record
+ "do_not_record": talk.submission.do_not_record,
+ "tags": talk.submission.get_tag()
}
)
else:
diff --git a/src/pretalx/static/agenda/scss/_speaker.scss b/src/pretalx/static/agenda/scss/_speaker.scss
index 395473ede..a1163e533 100644
--- a/src/pretalx/static/agenda/scss/_speaker.scss
+++ b/src/pretalx/static/agenda/scss/_speaker.scss
@@ -52,6 +52,9 @@
max-width: 100%;
}
}
+ .submission_tag {
+ padding: 0px 5px;
+ }
}
}
diff --git a/src/pretalx/submission/models/submission.py b/src/pretalx/submission/models/submission.py
index 417a57ad9..f4af10570 100644
--- a/src/pretalx/submission/models/submission.py
+++ b/src/pretalx/submission/models/submission.py
@@ -337,6 +337,16 @@ def get_duration(self) -> int:
return self.submission_type.default_duration
return self.duration
+ def get_tag(self):
+ tags = []
+ for tag in self.tags.all():
+ tags.append({
+ 'id': tag.id,
+ 'tag': tag.tag,
+ 'color': tag.color
+ })
+ return tags
+
def update_duration(self):
"""Apply the submission's duration to its currently scheduled.