better demo template
authorcavaliet
Thu, 06 Nov 2014 12:58:21 +0100
changeset 151 b55b70874cf4
parent 150 ea5016b24fc9
child 152 fe676b44d9a5
better demo template
src/spel/static/spel/css/spel.css
src/spel/templates/spel_demonstrateur.html
src/spel/views.py
--- a/src/spel/static/spel/css/spel.css	Wed Nov 05 17:54:12 2014 +0100
+++ b/src/spel/static/spel/css/spel.css	Thu Nov 06 12:58:21 2014 +0100
@@ -113,4 +113,10 @@
 }
 .play-button{
 	color: #333;
-}
\ No newline at end of file
+}
+/* demonstrateur */
+.link-table{
+	max-height: 200px;
+	overflow: scroll;
+}
+
--- a/src/spel/templates/spel_demonstrateur.html	Wed Nov 05 17:54:12 2014 +0100
+++ b/src/spel/templates/spel_demonstrateur.html	Thu Nov 06 12:58:21 2014 +0100
@@ -6,8 +6,8 @@
 {% block spel_content %}
     <section style="width: 1070px; margin: 0 auto">
       <div class="row">
-        <div class="col-md-7">
-	      {% if current_ctt_id != '' %}
+        {% if current_ctt_id != '' %}
+          <div class="col-md-7">
 	        <h3>{{ demo_title }}</h3>
 	        <p><strong>{{ proj_title }}</strong></p>
 	        <p>{% if proj1_ldt_id %}<a href="?tag={{ tag }}&p={{ proj1_ldt_id }}">Extrait précédent</a>{% endif %}
@@ -16,20 +16,25 @@
 	        <p>{{ annot_title }}</p>
 	        <p>{{ annot_description }}</p>
 	        <p>{{ annot_tags|safe }}</p>
-            <select onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);">
-                <option value="">Sélectionner...</option>
-              {% for c in contents %}
-                <option value="?tag={{ tag }}&p={{ c.front_project.ldt_id }}" {% if current_ctt_id == c.front_project.ldt_id %}selected{% endif %}>{{ c.title }}</option>
-              {% endfor %}
-            </select>
-	      {% else %}
-	        <h2>Démonstrateur : choisissez une scène</h2>
-	        <p><a href="?tag=demo1_theatre&p={{ proj1_ldt_id }}">Scène d'introduction - Duo Brick et Maggy [répliques 7-1 à 9-5]</a></p>
-	        <p><a href="?tag=demo2_theatre&p={{ proj2_ldt_id }}">Scène duo Brick et Grand Pa [répliques 51-13 à 56-15]</a></p>
-	      {% endif %}
-		</div>
-		<div class="col-md-5">À venir
-		</div>
+	      </div>
+		  <div class="col-md-5">
+			  <p>Tous les extraits :</p>
+			  <div class="link-table">
+			    <table class="table table-striped table-condensed">
+			      {% for c in contents %}
+			      <tr>
+			        <td>{{ forloop.counter }}</td>
+			        <td>{% if current_ctt_id != c.front_project.ldt_id %}<a href="?tag={{ tag }}&p={{ c.front_project.ldt_id }}">{% endif %}{{ c.title|slice:"7:" }}{% if current_ctt_id != c.front_project.ldt_id %}</a>{% endif %}</td>
+			      </tr>
+			      {% endfor %}
+			    </table>
+			  </div>
+		  </div>
+        {% else %}
+          <h2>Démonstrateur : choisissez une scène</h2>
+          <p><a href="?tag=demo1_theatre&p={{ proj1_ldt_id }}">Scène d'introduction - Duo Brick et Maggy [répliques 7-1 à 9-5]</a></p>
+          <p><a href="?tag=demo2_theatre&p={{ proj2_ldt_id }}">Scène duo Brick et Grand Pa [répliques 51-13 à 56-15]</a></p>
+        {% endif %}
       </div>
       <div id="LdtPlayer"></div>
       <div id="AnnotationsListContainer"></div>
--- a/src/spel/views.py	Wed Nov 05 17:54:12 2014 +0100
+++ b/src/spel/views.py	Thu Nov 06 12:58:21 2014 +0100
@@ -523,7 +523,6 @@
 class Demonstrateur(TemplateView):
     template_name = "spel_demonstrateur.html"
     def get(self, request):
-        # Get start and end for date bounds (earliest is available only on django 1.6)
         tag = request.GET.get("tag", "demo_theatre")
         contents = Content.objects.filter(tags__name__in=[tag]).select_related("front_project__ldt_id").order_by("creation_date")
         # Get current project data
@@ -539,7 +538,7 @@
             project = get_object_or_404(Project, ldt_id=p)
             ps = ProjectJsonSerializer(project)
             project_dict = ps.serialize_to_cinelab()
-            # In this code, we know that a project only contains one annotation with type "performance"
+            # In this code, we know that a project contains only one annotation with type "performance"
             proj_title = project.title[16:]# remove "front project : "
             demo_title = ""
             if proj_title[:7]=="[demo1]":
@@ -556,7 +555,6 @@
                     annot_tags = get_tags(tag_list, "group")
                     break
             # check the position of the current project in the list of all project
-            
             project_ids = [ c.front_project.ldt_id for c in contents ]
             project_index = project_ids.index(p)
             if project_index > 0: