Update templates to consistently use {% static %} instead of hard coding paths
[htsworkflow.git] / htsworkflow / frontend / templates / samples / library_detail.html
index 6c6fa8d93a79015a4e3daf22941ea3cdc1a8d3da..65747dcac5194ca6d73191a3ad419d6c9f500fe1 100644 (file)
@@ -1,80 +1,19 @@
-{% extends "flowcell_libraries_app.html" %}
-{% load humanize %}
+{% extends "base_site.html" %}
+{% 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>
 
-{% block additional_css %}
-<style type="text/css">
-  /* <![CDATA[ */
-  div#librarydetail {
-    margin: 0;
-    padding: 0;
-  }
-  div#librarydetail table, div#librarydetail td {
-    border-style: solid;
-  }
-  div#librarydetail table {
-    border-width: 0 0 1px 1px;
-    border-spacing: 0;
-    border-collapse: collapse;
-  }
-  div#librarydetail td {
-    margin: 0;
-    padding: 3px;
-    border-width: 1px 1px 0 0;
-  }
-  div#librarydetail thead {
-    text-align: center;
-    }
-  div#librarydetail tbody {
-    text-align: right;
-  }
-  div#librarydetail h1,
-  div#librarydetail h2
-  {
-    font-size: 150%;
-  }
-
-  div#librarydetail h3 {
-     font-size: 125%;
-     margin: 0;
-  }
-
-  div#librarydetail h4,
-  div#librarydetail h5,
-  div#librarydetail ul,
-  div#librarydetail ol,
-  div#librarydetail li
-  {
-    list-style: none;
-    margin: 0;   
-  }
-
-  div#librarydetail ul,
-  div#librarydetail ol
-  {
-    margin-bottom: .5em;
-  }
- /* ]]> */
-</style>
+    {% block additional_javascript %}
+    {% endblock %}
 {% endblock %}
 
 {% block content %}
-<div id="librarydetail">
-  <h2>About this library</h2>
-  <b>Library ID</b>: {{ lib.id }}<br/>
-  <b>Name</b>: {{ lib.library_name }}<br/>
-  <b>Species</b>: {{ lib.library_species.scientific_name }}<br/>
-  <b>Concentration</b>: {{ lib.undiluted_concentration }} ng/µl<br/>
-  <b>Gel Cut Size</b>: {{ lib.gel_cut_size }}<br/>
-  <b>Insert Size</b>: {{ lib.insert_size }}<br/>
-  <b>Replicate</b>: {{ lib.replicate }}<br/>
-  <b>Made By</b>: {{ lib.made_by }} <br/>
-  <b>Affiliations</b>:
-  <ul>
-    {% for individual in lib.affiliations.all %}
-      <li>{{ individual.name }} ( {{ individual.contact }} )</li>
-    {% endfor %}
-  </ul>
-  
+  {% include "sample_header.html" %}
+  <hr/>
+  <div class="library_statistics">
   <h2>Raw Result Files</h2>
   <table>
   <thead>
       <td>Bed</td>
       <td>Archived</td>
     </tr>
-  {% for result in eland_results %}
-  <tr>
-    <td>{{ result.run_date|date }}</td>
-    <td>{{ result.cycle }}</td>
-    <td>{{ result.flowcell_id }}</td>
-    <td>{{ result.lane }}</td>
-    <td><a href="{{ result.summary_url }}">Summary</a></td>
-    <td><a href="{{ result.result_url }}">{{ result.result_label }}</a></td>
-    <td>
-    {% if result.bed_url %}
-      <a href="{{ result.bed_url }}">Bed</a>
-    {% endif %}
-    </td>
-    <td>
-      {% if result.storage_ids %}
-        {{ result.storage_ids|safe }}
+  </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="{% 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>
+      {% if result.bed_url %}
+        <a href="{{ result.bed_url }}">Bed</a>
       {% endif %}
-    </td>
-  </tr>
-  {% endfor %}
+      </td>
+      <td>
+        {% if result.storage_ids %}
+          {{ result.storage_ids|safe }}
+        {% endif %}
+      </td>
+    </tr>
+    {% endfor %}
+  {% else %}
+    <tr><td colspan="8">No data</td></tr>
+  {% endif %}
+  </tbody>
   </table>
-  
+
   <h2>Lane Summary Statistics</h2>
   {% block summary_stats %}
   <table>
       </tr>
     </thead>
     <tbody>
-  
-      {% for lane in lane_summary_list %}
-      <tr>
-        <td>{{ lane.cycle_width }}</td>
-        <td>{{ lane.flowcell_id }}</td>
-        <td>{{ lane.lane_id }}</td>
-        <td>{% if lane.end %}{{ lane.end }}{% endif %}</td>
-        <td>{{ lane.clusters.0|intcomma }}</td>
-        <td>{{ lane.successful_pm }}</td>
-        <td>{{ lane.reads|intcomma }}</td>
-        <td>{{ lane.no_match|intcomma }}</td>
-        <td>{{ lane.no_match_percent|stringformat:".2f" }}</td>
-        <td>{{ lane.qc_failed|intcomma }}</td>
-        <td>{{ lane.qc_failed_percent|stringformat:".2f" }}</td>
-        <td>{{ lane.match_codes.U0|intcomma }}</td>
-        <td>{{ lane.match_codes.U1|intcomma }}</td>
-        <td>{{ lane.match_codes.U2|intcomma }}</td>
-        <td>{{ lane.unique_reads|intcomma }}</td>
-        <td>{{ lane.match_codes.R0|intcomma }}</td>
-        <td>{{ lane.match_codes.R1|intcomma }}</td>
-        <td>{{ lane.match_codes.R2|intcomma }}</td>
-        <td>{{ lane.repeat_reads|intcomma }}</td>
+    {% if lane_summary_list %}
+      {# ls short for lane summary #}
+      {% for ls in lane_summary_list %}
+      <tr about="{{ls.lane.get_absolute_url}}">
+        <td>{{ ls.cycle_width }}</td>
+        <td><a href="{{ls.flowcell.get_absolute_url}}">{{ ls.flowcell_id }}</a>
+        </td>
+        <td><a href="{{ls.lane.get_absolute_url}}">{{ ls.lane_id }}</a></td>
+        <td>{% if ls.end %}{{ ls.end }}{% endif %}</td>
+        <td>{{ ls.clusters.0|intcomma }}</td>
+        <td>{{ ls.successful_pm }}</td>
+        <td>{{ ls.reads|intcomma }}</td>
+        <td>{{ ls.no_match|intcomma }}</td>
+        <td>{{ ls.no_match_percent|stringformat:".2f" }}</td>
+        <td>{{ ls.qc_failed|intcomma }}</td>
+        <td>{{ ls.qc_failed_percent|stringformat:".2f" }}</td>
+        <td>{{ ls.match_codes.U0|intcomma }}</td>
+        <td>{{ ls.match_codes.U1|intcomma }}</td>
+        <td>{{ ls.match_codes.U2|intcomma }}</td>
+        <td {% if ls.unique_reads %}property="libns:total_unique_locations" content="{{ls.unique_reads}}" datatype="xsd:decimal"{% endif %}>{{ ls.unique_reads|intcomma }}</td>
+        <td>{{ ls.match_codes.R0|intcomma }}</td>
+        <td>{{ ls.match_codes.R1|intcomma }}</td>
+        <td>{{ ls.match_codes.R2|intcomma }}</td>
+        <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>
     <thead>
       <tr>
-       <td>Flowcell ID</td>
-       <td>Lane</td>
-       <td>Comment</td>
+       <td>Flowcell ID</td>
+       <td>Lane</td>
+       <td>Comment</td>
+      </tr>
     </thead>
+    {% if lib.lane_set.all %}
     <tbody>
       {% for lane in lib.lane_set.all %}
-      <tr>
-       <td>{{ lane.flowcell.flowcell_id }}</td>
-       <td>{{ lane.lane_number }}</td>
-       <td>{{ lane.comment }}</td>
-       {% endfor %}
+      <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="{% static "admin/img/icon_changelink.gif" %}" alt="Edit"/>
+            </a>
+          {% endif%}
+        </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/>
   <h2>Count of multi-reads</h2>
-  {% for lane in lane_summary_list %}
-    {% if lane.summarized_reads %}
-    <h3>
-      {{lane.cycle_width}} {{ lane.flowcell_id }} lane {{ lane.lane_id }} 
-      {% if lane.end %} end {{ lane.end }}{% endif %}
+  {% for eland_lane in lane_summary_list %}
+    {% if eland_lane.summarized_reads %}
+    <h3>{{eland_lane.cycle_width}} {{ eland_lane.flowcell_id }} lane {{ eland_lane.lane_id }}
+      {% if eland_lane.end %} end {{ eland_lane.end }}{% endif %}
     </h3>
-    <ul>
-      {% for name, counts in lane.summarized_reads.items %}
-      <li><b>{{ name }}</b>: {{ counts|intcomma }}</li>
+    <ul about="{{eland_lane.lane.get_absolute_url}}">
+      {% for name, counts in eland_lane.summarized_reads.items %}
+      <li rel="libns:has_mappings">
+         <b property="libns:mapped_to">{{ name }}</b>:
+         <span property="libns:reads" content="{{counts}}" datatype="xsd:integer">{{ counts|intcomma }}</span></li>
       {% endfor %}
     </ul>
     {% endif %}
   {% endfor %}
   {% endblock %}
-</div>
+  </div>
 {% endblock %}