Little chapter table modif
authorcavaliet
Tue, 11 Mar 2014 18:59:24 +0100
changeset 16 a41d76310c7d
parent 15 acf4460a8074
child 17 d8b6ea26da6e
Little chapter table modif
src/spel/templates/partial/spel_chapters.html
src/spel/templatetags/spel_tags.py
src/spel/views.py
--- a/src/spel/templates/partial/spel_chapters.html	Tue Mar 11 17:43:28 2014 +0100
+++ b/src/spel/templates/partial/spel_chapters.html	Tue Mar 11 18:59:24 2014 +0100
@@ -4,14 +4,14 @@
 <p>{{ segments|length }} segment(s) trouvé(s)</p>
 <table class="table table-striped table-condensed tablesorter">
     <thead>
-        <tr><th>Type</th><th>Ref texte</th><th>début - fin</th><th>&nbsp;</th></tr>
+        <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><td>{{ s.cutting_id }}</td><td>{{ s.tags|get_tags:"ref_text_2"|join:', ' }}</td><td>{{ s.start_ts|str_duration }} - {{ s.start_ts|add:s.duration|str_duration }}</td>
+    <tr><td>{{ s.cutting_id }}</td><td>{{ s.tags|get_tags:"ref_text"|join:', ' }}</td><td>{{ s.content.title }}</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="{{ s.tags|get_tags:'group'|safe }}"><span class="glyphicon glyphicon-plus-sign"></span></button>
+                  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 %}
--- a/src/spel/templatetags/spel_tags.py	Tue Mar 11 17:43:28 2014 +0100
+++ b/src/spel/templatetags/spel_tags.py	Tue Mar 11 18:59:24 2014 +0100
@@ -23,18 +23,6 @@
             except:
                 continue
             val.append(t[t.index(":")+2:])
-    elif arg=="ref_text_2":
-        for t in a:
-            try:
-                t.index(":")
-            except:
-                continue
-            if t[:t.index(":")]=="ref_text":
-                tag_split = t.split(":")
-                if len(tag_split)>2:
-                    val.append( ":".join(tag_split[2:]) )
-                else:
-                    val.append(t[t.index(":")+2:])
     elif arg=="modscen_and_perso":
         for t in a:
             try:
--- a/src/spel/views.py	Tue Mar 11 17:43:28 2014 +0100
+++ b/src/spel/views.py	Tue Mar 11 18:59:24 2014 +0100
@@ -55,7 +55,7 @@
         #logger.debug(iri_ids)
         # Filter segment if necessary
         annot_types_param = request.GET.get("annotation_types", "")
-        seg_queryset = Segment.objects.filter(iri_id__in=iri_ids)
+        seg_queryset = Segment.objects.filter(iri_id__in=iri_ids).select_related('content__title')
         if annot_types_param!="":
             annot_types = annot_types_param.split(",")
             seg_queryset = seg_queryset.filter(cutting_id__in=annot_types)