about summary refs log tree commit diff
path: root/uploader/templates
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-04-28 02:11:25 -0500
committerFrederick Muriuki Muriithi2025-04-28 02:37:45 -0500
commit4a16f580a25aba122a4990a61e0e96f4692b833c (patch)
treeeb3fd65bad0f4bbaa033a0444edb0f0f18d474a7 /uploader/templates
parent77f18b73276d2bf57b52703b48e3b44b3c89c516 (diff)
downloadgn-uploader-4a16f580a25aba122a4990a61e0e96f4692b833c.tar.gz
Initialise entry-point for managing publications.
Diffstat (limited to 'uploader/templates')
-rw-r--r--uploader/templates/base.html3
-rw-r--r--uploader/templates/publications/base.html12
-rw-r--r--uploader/templates/publications/index.html83
3 files changed, 98 insertions, 0 deletions
diff --git a/uploader/templates/base.html b/uploader/templates/base.html
index 09e6470..de9c226 100644
--- a/uploader/templates/base.html
+++ b/uploader/templates/base.html
@@ -46,6 +46,9 @@
       <ul class="nav flex-column">
         <li {%if activemenu=="home"%}class="activemenu"{%endif%}>
           <a href="/" >Home</a></li>
+        <li {%if activemenu=="publications"%}class="activemenu"{%endif%}>
+          <a href="{{url_for('publications.index')}}"
+             title="View and manage publications.">Publications</a></li>
         <li {%if activemenu=="species"%}class="activemenu"{%endif%}>
           <a href="{{url_for('species.list_species')}}"
              title="View and manage species information.">Species</a></li>
diff --git a/uploader/templates/publications/base.html b/uploader/templates/publications/base.html
new file mode 100644
index 0000000..db80bfa
--- /dev/null
+++ b/uploader/templates/publications/base.html
@@ -0,0 +1,12 @@
+{%extends "base.html"%}
+
+{%block lvl1_breadcrumbs%}
+<li {%if activelink=="publications"%}
+    class="breadcrumb-item active"
+    {%else%}
+    class="breadcrumb-item"
+    {%endif%}>
+  <a href="{{url_for('publications.index')}}">Publications</a>
+</li>
+{%block lvl2_breadcrumbs%}{%endblock%}
+{%endblock%}
diff --git a/uploader/templates/publications/index.html b/uploader/templates/publications/index.html
new file mode 100644
index 0000000..f6f6fa0
--- /dev/null
+++ b/uploader/templates/publications/index.html
@@ -0,0 +1,83 @@
+{%extends "publications/base.html"%}
+{%from "flash_messages.html" import flash_all_messages%}
+
+{%block title%}Publications{%endblock%}
+
+{%block pagetitle%}Publications{%endblock%}
+
+
+{%block contents%}
+{{flash_all_messages()}}
+
+<div class="row">
+  <table id="tbl-list-publications" class="table compact stripe">
+    <thead>
+      <tr>
+        <th>#</th>
+        <th>PubMed ID</th>
+        <th>Title</th>
+        <th>Authors</th>
+      </tr>
+    </thead>
+
+    <tbody></tbody>
+  </table>
+</div>
+{%endblock%}
+
+
+{%block javascript%}
+<script type="text/javascript">
+  $(function() {
+      var publicationsDataTable = buildDataTable(
+          "#tbl-list-publications",
+          [],
+          [
+              {data: "index"},
+              {
+                  data: (pub) => {
+                  if(pub.PubMed_ID) {
+                      return `<a href="https://pubmed.ncbi.nlm.nih.gov/` +
+                          `${pub.PubMed_ID}/" target="_blank">` +
+                          `${pub.PubMed_ID}</a>`;
+                  }
+                  return "";
+                  }
+              },
+              {
+                  data: (pub) => {
+                  var title = "βΈ»";
+                  if(pub.Title) {
+                      title = pub.Title
+                  }
+                  return `<a href="/publications/view/${pub.Id}" ` +
+                      `target="_blank">${title}</a>`;
+                  }
+              },
+              {
+                  data: (pub) => {
+                  authors = pub.Authors.split(",").map(
+                      (item) => {return item.trim();});
+                  if(authors.length > 1) {
+                      return authors[0] + ", et. al.";
+                  }
+                  return authors[0];
+                  }
+              }
+          ],
+          {
+              ajax: {
+                  url: "/publications/list",
+                  dataSrc: "publications"
+              },
+              scrollY: 700,
+              paging: false,
+              deferRender: true,
+              layout: {
+                  topStart: "info",
+                  topEnd: "search"
+              }
+          });
+  });
+</script>
+{%endblock%}