Commit 519f9698 authored by fred's avatar fred
Browse files

list future and recent episodes

parent 79347811
......@@ -51,10 +51,24 @@ class EmissionMixin:
select_params=(False, True),
where=['''datetime = (SELECT MIN(datetime)
FROM emissions_diffusion
WHERE episode_id = emissions_episode.id)'''],
WHERE episode_id = emissions_episode.id
AND datetime <= CURRENT_TIMESTAMP)'''],
tables=['emissions_diffusion'],
).order_by('-first_diffusion').distinct()
context['futurEpisodes'] = \
episodes_queryset.extra(select={
'first_diffusion': 'emissions_diffusion.datetime',
},
select_params=(False, True),
where=['''datetime = (SELECT MIN(datetime)
FROM emissions_diffusion
WHERE episode_id = emissions_episode.id
AND datetime > CURRENT_TIMESTAMP)'''],
tables=['emissions_diffusion'],
).order_by('first_diffusion').distinct()
# get all related soundfiles in a single query
soundfiles = {}
if episode_ids is not None:
......
......@@ -889,6 +889,16 @@ h1.top#frequence {
font-size:80%;
}
#Emission-tabs-menu .futur-episodes h5,
#Emission-tabs-menu .recent-episodes h5 {
font-size: 1.2em;
margin-bottom: 0.5ex;
}
#Emission-tabs-menu #search-form {
margin-bottom: 1em;
}
ul.extra-soundfiles li {
position: relative;
}
......
......@@ -23,6 +23,7 @@
</div>
<div id="Emission-tabs-menu" class="rightPart episodes">
{% if news %}
<div class="sub">
<h5 class="sectionLabel">Actu</h5>
......@@ -33,20 +34,27 @@
</ul>
</div>
{% endif %}
<h5 class="sectionLabel right"><a class="" href="{% url 'emissionEpisodes' slug=emission.slug %}">Tous ({{ episodes.count }})</a></h5>
<h5 class="sectionLabel">Épisodes</h5>
<form method="get" action="{% url 'emissionEpisodes' slug=emission.slug %}" class="" id="search-form">
<input id="id_q" name="q" type="text" {% if search_query %}value="{{ search_query }}"{% endif %}>
<button class="icon-search"></button>
</form>
{% if futurEpisodes %}
<div class="sub">
<h5 class="sectionLabel">Bientôt</h5>
{% for episode in futurEpisodes %}
<div class="legend">{{ episode.first_diffusion|date:"F Y" }}</div>
{% episode_resume date="daytime" %}
<div class="sub futur-episodes">
<h5 class="sectionLabel">À venir</h5>
{% for episode in futurEpisodes|slice:":3" %}
{% episode_inline %}
{% endfor %}
</div>
{% endif %}
{% if episodes.exists %}
<div class="sub">
<h5 class="sectionLabel right"><a class="" href="{% url 'emissionEpisodes' slug=emission.slug %}">Tous ({{ episodes.count }})</a></h5>
<h5 class="sectionLabel">Derniers épisodes</h5>
<div class="sub recent-episodes">
<h5 class="sectionLabel">Récemment</h5>
{% with episodes|slice:"0:5" as episodes %}
{% for episode in episodes %}
......
......@@ -49,13 +49,6 @@
</div>
{% endif %}
</div>
<div class="rightPart">
<form method="get" action="{% url 'emissionEpisodes' slug=emission.slug %}" class="" id="search-form">
<label for="id_q">Rechercher :</label>
<input id="id_q" name="q" type="text" {% if search_query %}value="{{ search_query }}"{% endif %}>
<button class="icon-search"></button>
</form>
</div>
</header>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment