{% extends "home/base.html" %}
{% load staticfiles i18n %}

{% block programmes_class %}class="active"{% endblock %}
{% block content %}
	<h1><a href="{% url 'programmes:detail' programme.slug %}">{{ programme.name }}</a></h1>
	<div class="row">
		<div class="span8">
			<div class="media">
				<a href="{% url 'programmes:detail' programme.slug %}"><img src="{{ programme.photo.url }}"></a>
			</div>
			<p>{{programme.synopsis|truncatewords:12}}</p>
		</div>
	</div>
		<h2>{% firstof episode.title programme %}: <small>{% if episode.issue_date %} {{episode.issue_date|date:"DATETIME_FORMAT"}} {% else %}{% trans "Schedule pending" %} {% endif %}</small></h2>
		<p>{{ episode.summary }}</p>
		
		<h3>{% trans "Podcast"|upper %}</h3>
		{% if episode.podcast %}
			<audio src="{{episode.podcast.url}}"  type="{{episode.podcast.mime_type}}" controls>
			<p>{% trans "Sorry, HTML5 audio not supported." %}</p>
			</audio>
		{% else %}
			{% if not episode_end_date or now > episode_end_date %}
				{% trans "Sorry, this podcast isn't available yet" %}
			{% else %}
				{% trans "The podcast will be available in" %} {{  episode_end_date|timeuntil }}
			{% endif %}
		{% endif %}
		
		{% if role_list %}
			<h3>{% trans "Staff"|upper %}</h3>
			<dl id="tabulate">
				{% for role in role_list %}
					<dt><a href="{% url 'users:detail' role.person.userprofile.slug %}">{% firstof role.person.get_full_name role.person %}
					 {% if unspecified != role.role %}({{ role.get_role_display }}){% endif %}
					</a></dt>
					<dd>{% if role.description %}{{role.description}}{% else %}.{% endif %} </dd>
				{% endfor %}
			</dl>
		{% endif %}
{% endblock %}