{% load static %}
{% load front_tags %}
{% load spel_tags %}
{% if annot_chapters %}
<p class="bg-primary info">Chapitres correspondant aux annotations :</p>
{% endif %}
<div class="row">
  <div class="col-md-8">
	<ul class="list-inline chapter-tag-list">
	    {% for t in annot_types %}<li class="small searched-tag type">{{ t|remove_tag_key }} <span class="glyphicon glyphicon-remove small"></span></li>{% endfor %}
	    {% for t in mod_scen %}<li class="small searched-tag modscen">{{ t|remove_tag_key }} <span class="glyphicon glyphicon-remove small"></span></li>{% endfor %}
	    {% for t in perso %}<li class="small searched-tag perso">{{ t|remove_tag_key }} <span class="glyphicon glyphicon-remove small"></span></li>{% endfor %}
	</ul>
    <p>{{ segments|length }} segment(s) trouvé(s)</p>
  </div>
  {% if not annot_chapters %}
  <div class="col-md-4">
    <button class="chapter-to-annot btn btn-info multiline btn-xs">Annotations correspondant aux chapitres</button>
  </div>
  {% endif %}
</div>
<table class="table table-striped table-condensed tablesorter">
    <thead>
        <tr><th>Type</th><th>Ref texte</th><th>Titre de la vidéo</th><th>&nbsp;</th></tr>
    </thead>
    <tbody>
  {% for s in segments %}
    <tr class="chapter-data" data-content="{{ s.iri_id }}" data-start="{{ s.start_ts }}" data-end="{{ s.start_ts|add:s.duration }}">
        <td>{{ s.cutting_id }}</td><td>{{ s.tags|get_tags:"ref_text"|join:', ' }}</td><td>{% if annot_chapters %}{{ s.ct }}{% else %}{{ s.content.title }}{% endif %}</td>
        <td>
          <button type="button" class="popinfo btn btn-xs btn-default" data-trigger="hover" data-container="body" data-toggle="popover" data-placement="auto" 
                  data-content="<strong>Timecodes:</strong> {{ s.start_ts|str_duration }} - {{ s.start_ts|add:s.duration|str_duration }}<br/>{{ s.tags|get_tags:'group'|safe }}"><span class="glyphicon glyphicon-plus-sign"></span></button>
        </td>
    </tr>
  {% endfor %}
    <tbody>
</table>
