Skip to content
Snippets Groups Projects
Verified Commit 5fc647fb authored by weeman's avatar weeman
Browse files

Zeige aktuellen und nächsten Stream-Titel auf der Startseite an.

Füge außerdem einen Link zum Raum hinzu.
parent ebdf99c0
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,8 @@ from django.contrib.contenttypes.fields import GenericRelation ...@@ -10,7 +10,8 @@ from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.postgres.fields import DateTimeRangeField from django.contrib.postgres.fields import DateTimeRangeField
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.db.models import Q, QuerySet from django.db.models import ObjectDoesNotExist, Q, QuerySet
from django.utils import timezone
from django.utils.text import slugify from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
...@@ -421,6 +422,24 @@ class Room(BackendMixin, ActivityLogMixin, models.Model): ...@@ -421,6 +422,24 @@ class Room(BackendMixin, ActivityLogMixin, models.Model):
obj.clean() obj.clean()
return obj return obj
def get_current_event(self):
now = timezone.now()
try:
event = self.events.conference_accessible(self.conference).get(schedule_start__lte=now, schedule_end__gte=now)
return event
except ObjectDoesNotExist:
return None
def get_next_event(self):
now = timezone.now()
try:
event = self.events.conference_accessible(self.conference).filter(schedule_start__gt=now).order_by('schedule_start').first()
return event
except ObjectDoesNotExist:
return None
class RoomShare(models.Model): class RoomShare(models.Model):
class Meta: class Meta:
......
...@@ -23,10 +23,26 @@ ...@@ -23,10 +23,26 @@
{% if conf.is_running and public_streams %} {% if conf.is_running and public_streams %}
<div class="hub-hlayout"> <div class="hub-hlayout">
{% for stream in public_streams %} {% for stream in public_streams %}
<div class="hub-card hub-layout-equal"> {% with event = stream.get_current_event() %}
<h2 class="hub-section-title">{{ stream.name }}</h2> <div class="hub-card hub-layout-equal hub-vlayout">
{{ integrations.vocPlayer(playerId="player-" ~ stream.slug) }} {{ integrations.vocPlayer(playerId="player-" ~ stream.slug) }}
</div> <small class="hub-index-stream__name">
{% if event %}
{{ _("Now: %(name)", name=event.name) }}
{% else %}
{% with next_event = stream.get_next_event() %}
{% if next_event %}
{% set next_event_time = next_event.schedule_start | strftimehm %}
{{ _("Next (%(time)s): %(name)s", time=next_event_time, name=next_event.name) }}
{% endif %}
{% endwith %}
{% endif %}
</small>
<div>
<a class="hub-btn" href="{{ url('plainui:room', stream.slug) }}">{{ stream.name }}</a>
</div>
</div>
{% endwith %}
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
......
...@@ -1010,6 +1010,13 @@ msgstr "" ...@@ -1010,6 +1010,13 @@ msgstr ""
msgid "Your timezone is configured to %(user_timezone)s, conference timezone is %(conf_timezone)s, showing times in your timezone" msgid "Your timezone is configured to %(user_timezone)s, conference timezone is %(conf_timezone)s, showing times in your timezone"
msgstr "Deine Zeitzone ist auf %(user_timezone)s konfiguriert, die Konferenz findet jedoch in %(conf_timezone)s statt - zeige die Uhrzeiten in deiner Zeitzone" msgstr "Deine Zeitzone ist auf %(user_timezone)s konfiguriert, die Konferenz findet jedoch in %(conf_timezone)s statt - zeige die Uhrzeiten in deiner Zeitzone"
msgid "Now: %(name)"
msgstr "Jetzt: %(name)s"
#, python-format
msgid "Next (%(time)s): %(name)s"
msgstr "Nächster (%(time)s): %(name)s"
#, python-format #, python-format
msgid "%(conf)s - Login" msgid "%(conf)s - Login"
msgstr "" msgstr ""
......
...@@ -1010,6 +1010,13 @@ msgstr "" ...@@ -1010,6 +1010,13 @@ msgstr ""
msgid "Your timezone is configured to %(user_timezone)s, conference timezone is %(conf_timezone)s, showing times in your timezone" msgid "Your timezone is configured to %(user_timezone)s, conference timezone is %(conf_timezone)s, showing times in your timezone"
msgstr "" msgstr ""
msgid "Now: %(name)"
msgstr ""
#, python-format
msgid "Next (%(time)s): %(name)s"
msgstr ""
#, python-format #, python-format
msgid "%(conf)s - Login" msgid "%(conf)s - Login"
msgstr "" msgstr ""
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
@import "./components/player"; @import "./components/player";
@import "./components/slider"; @import "./components/slider";
@import "./components/static-pages"; @import "./components/static-pages";
@import "./components/streams";
@import "./components/syntaxhilite"; @import "./components/syntaxhilite";
@import "./components/tags"; @import "./components/tags";
@import "./components/tile-board"; @import "./components/tile-board";
......
.hub-index-stream__name {
box-orient: vertical;
-webkit-box-orient: vertical;
display: -webkit-box;
height: 2lh;
line-clamp: 2;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment