about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-11-03 13:47:30 -0600
committerFrederick Muriuki Muriithi2025-11-03 13:49:41 -0600
commit09070949cfe5d99b999ce93358a284b9cd7880da (patch)
treebb80f8bc1592e183f78fd2eb2440d06b3b5685f2
parentea7d74dd341da50c1956ce59d5c788525893b0bf (diff)
downloadgn-uploader-09070949cfe5d99b999ce93358a284b9cd7880da.tar.gz
Improve UI to enable editing publication details.
-rw-r--r--uploader/phenotypes/views.py8
-rw-r--r--uploader/templates/phenotypes/view-phenotype.html54
2 files changed, 40 insertions, 22 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py
index 556b5ff..d02018d 100644
--- a/uploader/phenotypes/views.py
+++ b/uploader/phenotypes/views.py
@@ -245,13 +245,7 @@ def view_phenotype(# pylint: disable=[unused-argument]
             xref_id=xref_id,
             phenotype=phenotype,
             has_se=any(bool(item.get("error")) for item in phenotype["data"]),
-            publish_data={
-                key.replace("_", " "): val
-                for key,val in
-                (phenotype_publication_data(conn, phenotype["Id"]) or {}).items()
-                if (key in ("PubMed_ID", "Authors", "Title", "Journal")
-                    and __non_empty__(val))
-            },
+            publication=(phenotype_publication_data(conn, phenotype["Id"]) or {}),
             privileges=privileges,
             activelink="view-phenotype")
 
diff --git a/uploader/templates/phenotypes/view-phenotype.html b/uploader/templates/phenotypes/view-phenotype.html
index 21ac501..75e3c1e 100644
--- a/uploader/templates/phenotypes/view-phenotype.html
+++ b/uploader/templates/phenotypes/view-phenotype.html
@@ -24,8 +24,10 @@
 {{flash_all_messages()}}
 
 <div class="row">
-  <div class="panel panel-default">
-    <div class="panel-heading"><strong>Basic Phenotype Details</strong></div>
+  <div class="card">
+    <div class="card-header">
+      <h5 class="card-title">Basic Phenotype Details</h5>
+    </div>
 
     <table class="table">
       <tbody>
@@ -41,24 +43,46 @@
           <td><strong>Units</strong></td>
           <td>{{phenotype.Units}}</td>
         </tr>
-        {%for key,value in publish_data.items()%}
-        <tr>
-          <td><strong>{{key}}</strong></td>
-          <td>{{value}}</td>
-        </tr>
-        {%else%}
-        <tr>
-          <td colspan="2" class="text-muted">
-            <span class="glyphicon glyphicon-exclamation-sign"></span>
-            No publication data found.
-          </td>
-        </tr>
-        {%endfor%}
       </tbody>
     </table>
   </div>
 </div>
 
+<div class="row" style="margin-top:5px;">
+  <div class="card">
+    <div class="card-header">
+      <h5 class="card-title">Publication Details</h5>
+    </div>
+
+    <div class="card-body">
+      <table class="table">
+        <tbody>
+          <tr>
+            {%for key in ("PubMed_ID", "Authors", "Title", "Journal"):%}
+          <tr>
+            <td><strong>{{key}}</strong></td>
+            <td>{{publication.get(key, "")}}</td>
+          </tr>
+          {%else%}
+          <tr>
+            <td colspan="2" class="text-muted">
+              <span class="glyphicon glyphicon-exclamation-sign"></span>
+              No publication data found.
+            </td>
+          </tr>
+          {%endfor%}
+          </tr>
+        </tbody>
+      </table>
+      <div style="text-align: right;">
+        <a href="{{url_for('publications.edit_publication', publication_id=publication.Id, next=next)}}"
+           class="btn btn-info">edit</a>
+        <a href="#" class="btn btn-danger not-implemented">change</a>
+      </div>
+    </div>
+  </div>
+</div>
+
 {%if "group:resource:edit-resource" in privileges
 or "group:resource:delete-resource" in privileges%}
 <div class="row">