diff options
author | Frederick Muriuki Muriithi | 2025-04-28 03:54:16 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-04-28 03:54:16 -0500 |
commit | ffd16388090c9a2397efaeb0816bd6e87414498c (patch) | |
tree | da182cdd96dddb7ab61ef6a435ef4ba37aaae5c0 /uploader | |
parent | 031cfe6390188271a7e5bcc7db9d275197215f46 (diff) | |
download | gn-uploader-ffd16388090c9a2397efaeb0816bd6e87414498c.tar.gz |
View a publication's details.
Diffstat (limited to 'uploader')
-rw-r--r-- | uploader/publications/views.py | 17 | ||||
-rw-r--r-- | uploader/templates/publications/view-publication.html | 74 |
2 files changed, 90 insertions, 1 deletions
diff --git a/uploader/publications/views.py b/uploader/publications/views.py index 85d3aef..dc5b42b 100644 --- a/uploader/publications/views.py +++ b/uploader/publications/views.py @@ -6,7 +6,10 @@ from flask import Blueprint, render_template, current_app as app from uploader.authorisation import require_login -from .models import fetch_publications +from .models import ( + fetch_publications, + fetch_publication_by_id, + fetch_publication_phenotypes) from gn_libs.debug import __pk__ @@ -32,3 +35,15 @@ def list_publications(): fetch_publications(conn), start=1)), "status": "success" }) + + +@pubbp.route("/view/<int:publication_id>", methods=["GET"]) +@require_login +def view_publication(publication_id: int): + """View more details on a particular publication.""" + with database_connection(app.config["SQL_URI"]) as conn: + return render_template( + "publications/view-publication.html", + publication=fetch_publication_by_id(conn, publication_id), + linked_phenotypes=tuple(fetch_publication_phenotypes( + conn, publication_id))) diff --git a/uploader/templates/publications/view-publication.html b/uploader/templates/publications/view-publication.html new file mode 100644 index 0000000..c6bbb96 --- /dev/null +++ b/uploader/templates/publications/view-publication.html @@ -0,0 +1,74 @@ +{%extends "publications/base.html"%} +{%from "flash_messages.html" import flash_all_messages%} + +{%block title%}View Publication{%endblock%} + +{%block pagetitle%}View Publication{%endblock%} + + +{%block contents%} +{{flash_all_messages()}} + +<div class="row"> + <table class="table"> + <tr> + <th>PubMed</th> + <td> + {%if publication.PubMed_ID%} + <a href="https://pubmed.ncbi.nlm.nih.gov/{{publication.PubMed_ID}}/" + target="_blank">{{publication.PubMed_ID}}</a> + {%else%} + — + {%endif%} + </td> + </tr> + <tr> + <th>Title</th> + <td>{{publication.Title or "—"}}</td> + </tr> + <tr> + <th>Authors</th> + <td>{{publication.Authors or "—"}}</td> + </tr> + <tr> + <th>Journal</th> + <td>{{publication.Journal or "—"}}</td> + </tr> + <tr> + <th>Published</th> + <td>{{publication.Month or ""}} {{publication.Year or "—"}}</td> + </tr> + <tr> + <th>Volume</th> + <td>{{publication.Volume or "—"}}</td> + </tr> + <tr> + <th>Pages</th> + <td>{{publication.Pages or "—"}}</td> + </tr> + <tr> + <th>Abstract</th> + <td>{{publication.Abstract or "—"}}</td> + </tr> + </table> +</div> + +<div class="row"> + <form id="frm-edit-delete-publication" method="POST" action="#"> + <input type="hidden" name="publication_id" value="{{publication.Id}}" /> + <div class="form-group"> + <input type="submit" value="edit" class="btn btn-primary" /> + {%if linked_phenotypes | length == 0%} + <input type="submit" value="delete" class="btn btn-danger" /> + {%endif%} + </div> + </form> +</div> +{%endblock%} + + +{%block javascript%} +<script type="text/javascript"> + $(function() {}); +</script> +{%endblock%} |