Update templates to consistently use {% static %} instead of hard coding paths
[htsworkflow.git] / htsworkflow / frontend / templates / samples / library_detail.html
index 771538c01cd1ca16414d37862351d9d8ebe9639c..65747dcac5194ca6d73191a3ad419d6c9f500fe1 100644 (file)
@@ -1,9 +1,10 @@
 {% extends "base_site.html" %}
-{% load adminmedia humanize i18n %}
+{% load staticfiles %}
+{% load humanize i18n %}
 {% block extrahead %}
     <!-- App Stuff -->
-    <link type="text/css" rel="stylesheet" href="/static/css/app.css" />
-    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
+    <link type="text/css" rel="stylesheet" href="{% static "css/app.css" %}"/>
+    <script type="text/javascript" src="{% static "js/jquery.min.js" %}"></script>
 
     {% block additional_javascript %}
     {% endblock %}
     </tr>
   </thead>
   <tbody>
+  {% if eland_results %}
     {% for result in eland_results %}
     <tr about="{{result.flowcell.get_absolute_url}}">
       <td property="libns:date" content="{{result.run_date|date:'Y-m-d\TH:i:s'}}" datatype="xsd:dateTime">{{ result.run_date|date}}</td>
       <td>{{ result.cycle }}</td>
-      <td><a href="{{result.flowcell.get_absolute_url}}"><span property="libns:flowcell_id">{{ result.flowcell_id }}</span></a>{% if user.is_staff %}<a href="{{result.flowcell.get_admin_url}}"><img class="icon_button" src="/media/img/admin/icon_changelink.gif" alt="Edit"/></a>{% endif%}</td>
-      <td><a href="{{result.lane.get_absolute_url}}" rel="libns:has_lane"><span property="libns:lane_number" datatype="xsd:decimal">{{ result.lane.lane_number }}</span></a></td>
+      <td><a href="{{result.flowcell.get_absolute_url}}"><span property="libns:flowcell_id">{{ result.flowcell_id }}</span></a>{% if user.is_staff %}<a href="{{result.flowcell.get_admin_url}}"><img class="icon_button" src="{% static "admin/img/icon_changelink.gif" %}" alt="Edit"/></a>{% endif%}</td>
+      <td>{{ result.lane.lane_number }}</td>
       <td><a href="{{ result.summary_url }}">Summary</a></td>
       <td><a href="{{ result.result_url }}">{{ result.result_label }}</a></td>
       <td>
@@ -48,6 +50,9 @@
       </td>
     </tr>
     {% endfor %}
+  {% else %}
+    <tr><td colspan="8">No data</td></tr>
+  {% endif %}
   </tbody>
   </table>
 
@@ -85,7 +90,7 @@
       </tr>
     </thead>
     <tbody>
-
+    {% if lane_summary_list %}
       {# ls short for lane summary #}
       {% for ls in lane_summary_list %}
       <tr about="{{ls.lane.get_absolute_url}}">
         <td>{{ ls.repeat_reads|intcomma }}</td>
       </tr>
       {% endfor %}
-    </tbody>
-  </table>
+      {% else %}
+       <tr><td colspan="20">No data</td></tr>
+    {% endif %}
+  </tbody>
+    </table>
 
   <h2>Flowcell Notes</h2>
   <table>
        <td>Comment</td>
       </tr>
     </thead>
+    {% if lib.lane_set.all %}
     <tbody>
       {% for lane in lib.lane_set.all %}
-      <tr rel="libns:has_lane" resource="{{lane.get_absolute_url}}">
-        <td><a href="{{lane.flowcell.get_absolute_url}}" rel="libns:flowcell"
-            ><span property="libns:flowcell_id">{{ lane.flowcell.flowcell_id }}</span></a>
+      <tr rel="libns:has_lane" 
+          about="{{lib.get_absolute_url}}"
+          resource="{{lane.get_absolute_url}}">
+        <td>
+          <a typeof="libns:IlluminaFlowcell" href="{{lane.flowcell.get_absolute_url}}">
+            <span property="libns:flowcell_id"
+                  >{{lane.flowcell.flowcell_id}}</span></a>
           {% if user.is_staff %}
             <a href="{{lane.flowcell.get_admin_url}}">
                <img class="icon_button"
-                    src="/media/img/admin/icon_changelink.gif" alt="Edit"/>
+                    src="{% static "admin/img/icon_changelink.gif" %}" alt="Edit"/>
             </a>
           {% endif%}
         </td>
-        <td><a href="{{lane.get_absolute_url}}">
-            <span property="libns:lane_number"  datatype="xsd:decimal"
-               >{{ lane.lane_number }}</span></a></td>
+        <td typeof="libns:IlluminaLane" about="{{lane.get_absolute_url}}">
+          <span rel="libns:flowcell" resource="{{lane.flowcell.get_absolute_url}}"></span>
+          <a href="{{lane.get_absolute_url}}">
+            <span property="libns:lane_number"
+               >{{ lane.lane_number }}</span>
+            </a></td>
         <td>{{ lane.comment }}</td>
       </tr>
          {% endfor %}
     </tbody>
+    {% endif %}
   </table>
   <br/>
   <hr/>
   {% endfor %}
   {% endblock %}
   </div>
-</div>
 {% endblock %}