Commit b1c9b52f authored by fred's avatar fred

display and support extra sounds

parent 412c748b
......@@ -78,10 +78,13 @@ def episode_resume(context, date=None, model=None, klass=None):
@register.inclusion_tag('episodes/detail.html', takes_context=True)
def episode_detail(context, date=None):
soundfiles = SoundFile.objects.select_related().filter(
fragment=True, podcastable=True, episode=context.get('episode'))
return {
'episode': context.get('episode'),
'emission': context.get('emission'),
'diffusions': context.get('diffusions'),
'soundfiles': soundfiles,
'date': date,
}
......
......@@ -95,7 +95,6 @@ class EpisodeDetailView(DetailView, EmissionMixin):
context = super(EpisodeDetailView, self).get_context_data(**kwargs)
context['sectionName'] = "Emissions"
context['diffusions'] = Diffusion.objects.select_related().filter(episode=self.object.id)
context['soundfiles'] = SoundFile.objects.select_related().filter(episode=self.object.id)
context['emission'] = Emission.objects.get(slug=self.kwargs.get('emission_slug'))
context.update(self.get_emission_context(context['emission']))
return context
......
......@@ -931,6 +931,18 @@ h1.top#frequence {
font-size:80%;
}
ul.extra-soundfiles li {
position: relative;
}
ul.extra-soundfiles li div.audio {
display: inline;
top: 5px;
right: 0;
position: absolute;
font-size: 60%;
}
@media screen and (max-width: 400px) {
.episode .dateBloc{
width:4em;
......
......@@ -70,5 +70,16 @@
{% endif %}
</div>
</div>
{% if soundfiles.count %}
<div class="wrapper">
<ul class="padded custom list extra-soundfiles">
{% for soundfile in soundfiles %}
<li><strong>{{ soundfile.title }}</strong> {% audio sound=soundfile %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
......@@ -35,7 +35,8 @@
data-player='true'
class='hidden'
data-url="{% url 'episode-view' emission_slug=sound.episode.emission.slug slug=sound.episode.slug %}"
title="{{sound.episode.title}}"
{% if sound.fragment and sound.title %}title="{{ sound.title }}"
{% else %}title="{{sound.episode.title}}"{% endif %}
id="Audio-{{ sound.file.url|slugify }}"
preload="{% if preload %}{{ preload }}{% else %}none{% endif %}"
controls="{% if controls %}{{ controls }}{% else %}controls{% endif%}"
......@@ -64,7 +65,11 @@
},
"emission": "{{sound.episode.emission.slug}}",
"episode": "{{sound.episode.slug}}",
{% if sound.fragment and sound.title %}
"title": {{sound.title|jsonify|safe}},
{% else %}
"title": {{sound.episode.title|jsonify|safe}},
{% endif %}
"id":"{{ sound.file.url|slugify }}"
}
</code>
......
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