Commit 519f9698 authored by fred's avatar fred

list future and recent episodes

parent 79347811
...@@ -51,10 +51,24 @@ class EmissionMixin: ...@@ -51,10 +51,24 @@ class EmissionMixin:
select_params=(False, True), select_params=(False, True),
where=['''datetime = (SELECT MIN(datetime) where=['''datetime = (SELECT MIN(datetime)
FROM emissions_diffusion FROM emissions_diffusion
WHERE episode_id = emissions_episode.id)'''], WHERE episode_id = emissions_episode.id
AND datetime <= CURRENT_TIMESTAMP)'''],
tables=['emissions_diffusion'], tables=['emissions_diffusion'],
).order_by('-first_diffusion').distinct() ).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 # get all related soundfiles in a single query
soundfiles = {} soundfiles = {}
if episode_ids is not None: if episode_ids is not None:
......
...@@ -889,6 +889,16 @@ h1.top#frequence { ...@@ -889,6 +889,16 @@ h1.top#frequence {
font-size:80%; 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 { ul.extra-soundfiles li {
position: relative; position: relative;
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
</div> </div>
<div id="Emission-tabs-menu" class="rightPart episodes"> <div id="Emission-tabs-menu" class="rightPart episodes">
{% if news %} {% if news %}
<div class="sub"> <div class="sub">
<h5 class="sectionLabel">Actu</h5> <h5 class="sectionLabel">Actu</h5>
...@@ -33,20 +34,27 @@ ...@@ -33,20 +34,27 @@
</ul> </ul>
</div> </div>
{% endif %} {% 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 %} {% if futurEpisodes %}
<div class="sub"> <div class="sub futur-episodes">
<h5 class="sectionLabel">Bientôt</h5> <h5 class="sectionLabel">À venir</h5>
{% for episode in futurEpisodes %} {% for episode in futurEpisodes|slice:":3" %}
<div class="legend">{{ episode.first_diffusion|date:"F Y" }}</div> {% episode_inline %}
{% episode_resume date="daytime" %}
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
{% if episodes.exists %} {% if episodes.exists %}
<div class="sub"> <div class="sub recent-episodes">
<h5 class="sectionLabel right"><a class="" href="{% url 'emissionEpisodes' slug=emission.slug %}">Tous ({{ episodes.count }})</a></h5> <h5 class="sectionLabel">Récemment</h5>
<h5 class="sectionLabel">Derniers épisodes</h5>
{% with episodes|slice:"0:5" as episodes %} {% with episodes|slice:"0:5" as episodes %}
{% for episode in episodes %} {% for episode in episodes %}
......
...@@ -49,13 +49,6 @@ ...@@ -49,13 +49,6 @@
</div> </div>
{% endif %} {% endif %}
</div> </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> </header>
</div> </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