episode_detail.html 4.67 KB
Newer Older
1
{% extends "base.html" %}
fred's avatar
fred committed
2
{% load soundfiles panikdbtags nonstop %}
3 4 5 6 7 8 9 10 11 12
{% block appbar %}
<h2>{{ episode.emission.title }} — {{ episode.title }}</h2>
<span><a href="../">Retourner à l'émission</a></span>
{% endblock %}

{% block content %}

{% if can_manage %}
<p>
<a class="big-friendly-button" href="edit/">Modifier</a>
fred's avatar
fred committed
13
{% if perms.emissions.add_diffusion %}
14
<a class="big-friendly-button" id="add-diffusion-link" href="#">Ajouter une diffusion</a>
fred's avatar
fred committed
15
{% endif %}
16
<a class="big-friendly-button" id="add-soundfile-link" href="#">Ajouter un son</a>
17 18 19 20 21 22 23 24 25 26 27
{% if episode.effective_start and episode.effective_end %}
  {% if internal_ip %}
  <a class="big-friendly-button" id="download-recording" download href="{{ episode.get_pige_download_url }}">Télécharger l'enregistrement</a>
  {% endif %}
{% elif not soundfiles %}
  {% if episode.effective_start %}
    <a class="big-friendly-button" id="stop-recording" href="stop">Arrêter l'enregistrement</a>
  {% else %}
    <a class="big-friendly-button" id="start-recording" href="start">Démarrer l'enregistrement</a>
  {% endif %}
{% endif %}
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
<a class="big-friendly-button actually-not-that-friendly" href="delete/">Supprimer</a>
</p>
{% endif %}

{% if episode.subtitle %}
<div class="description">
{{ episode.subtitle|safe }}
</div>
{% endif %}

{% if episode.image %}
<div class="image">
  <img src="{{ episode.image.url }}"/>
</div>
{% endif %}

{% if episode.text %}
<div class="text">
{{ episode.text|safe }}
</div>
{% endif %}

{% if episode.tags.all %}
<p>
Tags :
{% for tag in episode.tags.all %}
  <span class="tag">{{ tag }}</span>{% if not forloop.last %}, {% endif %}
{% endfor %}
</p>
{% endif %}


<h3>Diffusions</h3>

fred's avatar
fred committed
62 63
{% now "Y-m-d H:i" as now %}

64 65 66
<ul>
{% for diffusion in diffusions %}
<li>{{ diffusion.datetime }}
67
{% if can_manage and perms.emissions.delete_diffusion %}
68 69
<a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>
{% endif %}
fred's avatar
fred committed
70 71 72
{% if soundfiles and perms.nonstop.add_track and diffusion.datetime|date:"Y-m-d H:i" > now and not diffusion|is_already_in_soma %}
<a href="{% url 'nonstop-add-diffusion' pk=diffusion.id %}">[programmer dans soma]</a>
{% endif %}
73 74 75 76 77 78 79
</li>
{% endfor %}
</ul>

<form id="add-diffusion-form" action="add-diffusion" method="POST" style="display: none;">
{% csrf_token %}
{{ add_diffusion_form.as_p }}
80
<button>Ajouter cet horaire</button>
81 82 83 84 85 86 87 88 89 90 91 92
<button class="cancel">Annuler</button>
</form>



<h3>Sons</h3>

<table id="soundfiles">
<thead>
<tr>
 <th>Fichier</th>
 <th>Titre</th>
fred's avatar
fred committed
93
 <th>Durée</th>
94 95 96
 <th>Format</th>
 <th>Podcastable?</th>
 <th>Fragment?</th>
97
 <th>Nb d'écoutes</th>
98 99 100 101 102 103 104 105 106
 {% if can_manage %}<th>Modifier</th>{% endif %}
 {% if can_manage %}<th>Supprimer</th>{% endif %}
 {% if perms.emissions.add_focus %}<th>Focus</th>{% endif %}
</thead>
<tbody>
{% for soundfile in soundfiles %}
<tr>
<td><a href="{{ soundfile.file.url }}">{{ soundfile|sound_filename }}</a></td>
<td>{{ soundfile.title }}</td>
fred's avatar
fred committed
107
<td>{{ soundfile.duration|as_duration }}</td>
108 109 110
<td>{% if soundfile.format %}{{ soundfile.format }}{% else %}-{% endif %}</td>
<td>{% if soundfile.podcastable %}oui{% else %}non{% endif %}</td>
<td>{% if soundfile.fragment %}oui{% else %}non{% endif %}</td>
111
<td>{{ soundfile|nb_visits }}</td>
112 113 114 115 116 117 118 119 120
{% if can_manage %}<td><a href="sounds/{{ soundfile.id }}/"
		class="icon-edit" title="Modifier"></a></td>{% endif %}
{% if can_manage %}<td><a href="sounds/{{ soundfile.id }}/remove"
		class="icon-remove-sign" title="Retirer"></a></td>{% endif %}
{% if perms.emissions.add_focus %}
<td>
{% if soundfile.has_focus %}
<a class="icon-pushpin" href="{{ soundfile|unset_focus_url }}">retirer</a>
{% else %}
121 122 123
  {% if soundfile.format %}
  <a class="icon-pushpin" href="{{ soundfile|set_focus_url }}">mettre</a>
  {% endif %}
124 125 126 127 128 129 130 131 132 133
{% endif %}
</td>
{% endif %}
{% endfor %}
</tbody>
</table>

<form id="add-soundfile-form" action="add-soundfile" method="POST" style="display: none;">
{% csrf_token %}
{{ add_soundfile_form.as_p }}
134
<button>Ajouter ce son</button>
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
<button class="cancel">Annuler</button>
</form>

{% endblock %}


{% block page-end %}
<script>
$(function() {
  $('#add-soundfile-link').click(
    function() {
      $('#id_title').parent().hide();
      $('#add-soundfile-form').dialog({modal: true, title: 'Son', width: 'auto'});
    });

  $('#add-diffusion-link').click(
    function() {
      $('#add-diffusion-form').dialog({modal: true, title: 'Horaire', width: 'auto'});
    });

  $('.image img').click(function() { $(this).toggleClass('large'); });

  $('#id_fragment').change(function() {
    if (this.checked) {
      $('#id_title').parent().show();
    } else {
      $('#id_title').parent().hide();
    }
  });

  $('button.cancel').click(function() {
    $(this).parent().dialog('close');
    return false;
  });
});
</script>
{% endblock %}