diff options
| author | Frederick Muriuki Muriithi | 2025-12-29 10:48:53 -0600 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2025-12-29 10:48:53 -0600 |
| commit | ab9a4a21e4b5a815b9c6dfd465d54e6df27d7364 (patch) | |
| tree | 8e6def116ab753527a5e281b1db2568d223378fb | |
| parent | 17af2a6b12ee4ddd4b4861319c2fc03dc73f9e19 (diff) | |
| download | gn-uploader-ab9a4a21e4b5a815b9c6dfd465d54e6df27d7364.tar.gz | |
Publications: Move feature to new UI templates.
| -rw-r--r-- | uploader/publications/views.py | 14 | ||||
| -rw-r--r-- | uploader/templates/publications/base.html | 13 | ||||
| -rw-r--r-- | uploader/templates/publications/create-publication.html | 23 | ||||
| -rw-r--r-- | uploader/templates/publications/delete-publication.html | 11 | ||||
| -rw-r--r-- | uploader/templates/publications/edit-publication.html | 13 | ||||
| -rw-r--r-- | uploader/templates/publications/index.html | 57 | ||||
| -rw-r--r-- | uploader/templates/publications/sui-base.html | 9 | ||||
| -rw-r--r-- | uploader/templates/publications/sui-create-publication.html | 200 | ||||
| -rw-r--r-- | uploader/templates/publications/sui-delete-publication.html | 95 | ||||
| -rw-r--r-- | uploader/templates/publications/sui-edit-publication.html | 203 | ||||
| -rw-r--r-- | uploader/templates/publications/sui-index.html | 109 | ||||
| -rw-r--r-- | uploader/templates/publications/sui-view-publication.html | 80 | ||||
| -rw-r--r-- | uploader/templates/publications/view-publication.html | 2 |
13 files changed, 79 insertions, 750 deletions
diff --git a/uploader/publications/views.py b/uploader/publications/views.py index 11732db..d9eb294 100644 --- a/uploader/publications/views.py +++ b/uploader/publications/views.py @@ -10,8 +10,6 @@ from flask import ( render_template, current_app as app) -from uploader.sui import sui_template - from uploader.flask_extensions import url_for from uploader.authorisation import require_login from uploader.route_utils import redirect_to_next @@ -32,7 +30,7 @@ pubbp = Blueprint("publications", __name__) @require_login def index(): """Index page for publications.""" - return render_template(sui_template("publications/index.html")) + return render_template("publications/index.html") @pubbp.route("/list", methods=["GET"]) @@ -74,7 +72,7 @@ def view_publication(publication_id: int): return redirect(url_for('publications.index')) return render_template( - sui_template("publications/view-publication.html"), + "publications/view-publication.html", publication=publication, linked_phenotypes=tuple(fetch_publication_phenotypes( conn, publication_id))) @@ -92,7 +90,7 @@ def create_publication(): if request.method == "GET": return render_template( - sui_template("publications/create-publication.html"), + "publications/create-publication.html", get_args=_get_args) form = request.form authors = form.get("publication-authors").encode("utf8") @@ -130,7 +128,7 @@ def edit_publication(publication_id: int): with database_connection(app.config["SQL_URI"]) as conn: if request.method == "GET": return render_template( - sui_template("publications/edit-publication.html"), + "publications/edit-publication.html", publication=fetch_publication_by_id(conn, publication_id), linked_phenotypes=tuple(fetch_publication_phenotypes( conn, publication_id)), @@ -181,12 +179,12 @@ def delete_publication(publication_id: int): flash("Cannot delete publication with linked phenotypes!", "alert-warning") return redirect(url_for( - sui_template("publications.view_publication"), + "publications.view_publication", publication_id=publication_id)) if request.method == "GET": return render_template( - sui_template("publications/delete-publication.html"), + "publications/delete-publication.html", publication=publication, linked_phenotypes=linked_phenotypes, publication_id=publication_id) diff --git a/uploader/templates/publications/base.html b/uploader/templates/publications/base.html index db80bfa..de0a350 100644 --- a/uploader/templates/publications/base.html +++ b/uploader/templates/publications/base.html @@ -1,12 +1,9 @@ {%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> +{%block breadcrumbs%} +{{super()}} +<li class="breadcrumb-item"> + <a href="{{url_for('publications.index')}}" + title="Manage publications">Publications</a> </li> -{%block lvl2_breadcrumbs%}{%endblock%} {%endblock%} diff --git a/uploader/templates/publications/create-publication.html b/uploader/templates/publications/create-publication.html index 3f828a9..fb0127d 100644 --- a/uploader/templates/publications/create-publication.html +++ b/uploader/templates/publications/create-publication.html @@ -3,7 +3,13 @@ {%block title%}View Publication{%endblock%} -{%block pagetitle%}View Publication{%endblock%} +{%block breadcrumbs%} +{{super()}} +<li class="breadcrumb-item"> + <a href="{{url_for('publications.create_publication', **get_args)}}" + title="Manage publications">create publication</a> +</li> +{%endblock%} {%block contents%} @@ -12,7 +18,7 @@ <div class="row"> <form id="frm-create-publication" method="POST" - action="{{url_for('publications.create_publication', **request.args)}}" + action="{{url_for('publications.create_publication', **get_args)}}" class="form-horizontal"> <div class="row mb-3"> @@ -152,11 +158,14 @@ </div> </div> - <div class="row mb-3"> - <div class="col-sm-2"></div> - <div class="col-sm-8"> - <input type="submit" class="btn btn-primary" value="Add" /> - <input type="reset" class="btn btn-danger" /> + <div class="row"> + <div class="col"> + <input type="submit" + class="btn btn-primary" + value="create publication" /> + </div> + <div class="col"> + <input type="reset" class="btn btn-danger" value="reset form" /> </div> </div> diff --git a/uploader/templates/publications/delete-publication.html b/uploader/templates/publications/delete-publication.html index 0ac93ec..a9c8c7c 100644 --- a/uploader/templates/publications/delete-publication.html +++ b/uploader/templates/publications/delete-publication.html @@ -1,9 +1,16 @@ {%extends "publications/base.html"%} {%from "flash_messages.html" import flash_all_messages%} -{%block title%}View Publication{%endblock%} +{%block title%}Delete Publication{%endblock%} -{%block pagetitle%}View Publication{%endblock%} +{%block breadcrumbs%} +{{super()}} +<li class="breadcrumb-item"> + <a href="{{url_for('publications.delete_publication', + publication_id=publication.Id)}}" + title="Manage publications">delete publication</a> +</li> +{%endblock%} {%block contents%} diff --git a/uploader/templates/publications/edit-publication.html b/uploader/templates/publications/edit-publication.html index 97fa134..314a78c 100644 --- a/uploader/templates/publications/edit-publication.html +++ b/uploader/templates/publications/edit-publication.html @@ -1,9 +1,16 @@ {%extends "publications/base.html"%} {%from "flash_messages.html" import flash_all_messages%} -{%block title%}View Publication{%endblock%} - -{%block pagetitle%}View Publication{%endblock%} +{%block title%}Edit Publication{%endblock%} + +{%block breadcrumbs%} +{{super()}} +<li class="breadcrumb-item"> + <a href="{{url_for('publications.edit_publication', + publication_id=publication.Id)}}" + title="Edit the publication's details">edit publication</a> +</li> +{%endblock%} {%block contents%} diff --git a/uploader/templates/publications/index.html b/uploader/templates/publications/index.html index 369812b..54d3fc0 100644 --- a/uploader/templates/publications/index.html +++ b/uploader/templates/publications/index.html @@ -3,16 +3,22 @@ {%block title%}Publications{%endblock%} -{%block pagetitle%}Publications{%endblock%} - {%block contents%} {{flash_all_messages()}} <div class="row" style="padding-bottom: 1em;"> - <a href="{{url_for('publications.create_publication')}}" - class="btn btn-primary"> - add new publication</a> + <div class="col"> + <a href="{{url_for('publications.create_publication')}}" + class="btn btn-primary" + title="Create a new publication."> + add new publication</a> + </div> +</div> + +<div class="row"> + <p>Click on title to view more details and to edit details for that + publication.</p> </div> <div class="row"> @@ -33,6 +39,8 @@ {%block javascript%} +<script type="text/javascript" src="/static/js/urls.js"></script> + <script type="text/javascript"> $(function() { var publicationsDataTable = buildDataTable( @@ -43,24 +51,25 @@ { searchable: true, data: (pub) => { - if(pub.PubMed_ID) { - return `<a href="https://pubmed.ncbi.nlm.nih.gov/` + - `${pub.PubMed_ID}/" target="_blank" ` + - `title="Link to publication on NCBI.">` + - `${pub.PubMed_ID}</a>`; - } - return ""; + if(pub.PubMed_ID) { + return `<a href="https://pubmed.ncbi.nlm.nih.gov/` + + `${pub.PubMed_ID}/" target="_blank" ` + + `title="Link to publication on NCBI.">` + + `${pub.PubMed_ID}</a>`; + } + return ""; } }, { searchable: true, data: (pub) => { - var title = "⸻"; - if(pub.Title) { - title = pub.Title - } - return `<a href="/publications/view/${pub.Id}" ` + - `target="_blank" ` + + var title = "⸻"; + if(pub.Title) { + title = pub.Title + } + url=buildURLFromCurrentURL( + `/publications/view/${pub.Id}`); + return `<a href="${url}" target="_blank" ` + `title="Link to view publication details">` + `${title}</a>`; } @@ -68,12 +77,12 @@ { searchable: true, data: (pub) => { - authors = pub.Authors.split(",").map( - (item) => {return item.trim();}); - if(authors.length > 1) { - return authors[0] + ", et. al."; - } - return authors[0]; + authors = pub.Authors.split(",").map( + (item) => {return item.trim();}); + if(authors.length > 1) { + return authors[0] + ", et. al."; + } + return authors[0]; } } ], diff --git a/uploader/templates/publications/sui-base.html b/uploader/templates/publications/sui-base.html deleted file mode 100644 index 64e41ef..0000000 --- a/uploader/templates/publications/sui-base.html +++ /dev/null @@ -1,9 +0,0 @@ -{%extends "sui-base.html"%} - -{%block breadcrumbs%} -{{super()}} -<li class="breadcrumb-item"> - <a href="{{url_for('publications.index')}}" - title="Manage publications">Publications</a> -</li> -{%endblock%} diff --git a/uploader/templates/publications/sui-create-publication.html b/uploader/templates/publications/sui-create-publication.html deleted file mode 100644 index 81edca6..0000000 --- a/uploader/templates/publications/sui-create-publication.html +++ /dev/null @@ -1,200 +0,0 @@ -{%extends "publications/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}View Publication{%endblock%} - -{%block breadcrumbs%} -{{super()}} -<li class="breadcrumb-item"> - <a href="{{url_for('publications.create_publication', **get_args)}}" - title="Manage publications">create publication</a> -</li> -{%endblock%} - - -{%block contents%} -{{flash_all_messages()}} - -<div class="row"> - <form id="frm-create-publication" - method="POST" - action="{{url_for('publications.create_publication', **get_args)}}" - class="form-horizontal"> - - <div class="row mb-3"> - <label for="txt-pubmed-id" class="col-sm-2 col-form-label"> - PubMed ID</label> - <div class="col-sm-10"> - <div class="input-group"> - <input type="text" - id="txt-pubmed-id" - name="pubmed-id" - class="form-control"/> - <div class="input-group-text"> - <button class="btn btn-outline-primary" - id="btn-search-pubmed-id">search</button> - </div> - </div> - <span id="search-pubmed-id-error" - class="form-text text-muted text-danger visually-hidden"> - </span> - <span class="form-text text-muted">This is the publication's ID on - <a href="https://pubmed.ncbi.nlm.nih.gov/" - title="Link to NCBI's PubMed service">NCBI's Pubmed Service</a> - </span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-publication-title" class="col-sm-2 col-form-label"> - Title</label> - <div class="col-sm-10"> - <input type="text" - id="txt-publication-title" - name="publication-title" - class="form-control" /> - <span class="form-text text-muted">Provide the publication's title here.</span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-publication-authors" class="col-sm-2 col-form-label"> - Authors</label> - <div class="col-sm-10"> - <input type="text" - id="txt-publication-authors" - name="publication-authors" - required="required" - class="form-control" /> - <span class="form-text text-muted"> - A publication <strong>MUST</strong> have an author. You <em>must</em> - provide a value for the authors field. - </span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-publication-journal" class="col-sm-2 col-form-label"> - Journal</label> - <div class="col-sm-10"> - <input type="text" - id="txt-publication-journal" - name="publication-journal" - class="form-control" /> - <span class="form-text text-muted">Provide the name journal where the - publication was done, here.</span> - </div> - </div> - - <div class="row mb-3"> - <label for="select-publication-month" - class="col-sm-2 col-form-label"> - Month</label> - <div class="col-sm-4"> - <select class="form-control" - id="select-publication-month" - name="publication-month"> - <option value="">Select a month</option> - <option value="january">January</option> - <option value="february">February</option> - <option value="march">March</option> - <option value="april">April</option> - <option value="may">May</option> - <option value="june">June</option> - <option value="july">July</option> - <option value="august">August</option> - <option value="september">September</option> - <option value="october">October</option> - <option value="november">November</option> - <option value="december">December</option> - </select> - <span class="form-text text-muted">Month of publication</span> - </div> - - <label for="txt-publication-year" - class="col-sm-2 col-form-label"> - Year</label> - <div class="col-sm-4"> - <input type="number" - id="txt-publication-year" - name="publication-year" - class="form-control" - min="1960" /> - <span class="form-text text-muted">Year of publication</span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-publication-volume" - class="col-sm-2 col-form-label"> - Volume</label> - <div class="col-sm-4"> - <input type="text" - id="txt-publication-volume" - name="publication-volume" - class="form-control"> - <span class="form-text text-muted">Journal volume</span> - </div> - - <label for="txt-publication-pages" - class="col-sm-2 col-form-label"> - Pages</label> - <div class="col-sm-4"> - <input type="text" - id="txt-publication-pages" - name="publication-pages" - class="form-control" /> - <span class="form-text text-muted">Journal pages for the publication</span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-abstract" class="col-sm-2 col-form-label">Abstract</label> - <div class="col-sm-10"> - <textarea id="txt-publication-abstract" - name="publication-abstract" - class="form-control" - rows="7"></textarea> - </div> - </div> - - <div class="row"> - <div class="col"> - <input type="submit" - class="btn btn-primary" - value="create publication" /> - </div> - <div class="col"> - <input type="reset" class="btn btn-danger" value="reset form" /> - </div> - </div> - -</form> -</div> - -{%endblock%} - - -{%block javascript%} -<script type="text/javascript" src="/static/js/pubmed.js"></script> -<script type="text/javascript"> - $(function() { - $("#btn-search-pubmed-id").on("click", (event) => { - event.preventDefault(); - var search_button = event.target; - var pubmed_id = $("#txt-pubmed-id").val().trim(); - remove_class($("#txt-pubmed-id").parent(), "has-error"); - if(pubmed_id == "") { - add_class($("#txt-pubmed-id").parent(), "has-error"); - return false; - } - - search_button.disabled = true; - // Fetch publication details - fetch_publication_details(pubmed_id, - [() => {search_button.disabled = false;}]); - return false; - }); - }); -</script> -{%endblock%} diff --git a/uploader/templates/publications/sui-delete-publication.html b/uploader/templates/publications/sui-delete-publication.html deleted file mode 100644 index 436f2c1..0000000 --- a/uploader/templates/publications/sui-delete-publication.html +++ /dev/null @@ -1,95 +0,0 @@ -{%extends "publications/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}Delete Publication{%endblock%} - -{%block breadcrumbs%} -{{super()}} -<li class="breadcrumb-item"> - <a href="{{url_for('publications.delete_publication', - publication_id=publication.Id)}}" - title="Manage publications">delete publication</a> -</li> -{%endblock%} - - -{%block contents%} -{{flash_all_messages()}} -<div class="row"> - <p>You are about to delete the publication with the following details:</p> -</div> - -<div class="row"> - <table class="table"> - <tr> - <th>Linked Phenotypes</th> - <td>{{linked_phenotypes | count}}</td> - </tr> - <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> - {%for line in (publication.Abstract or "—").replace("\r\n", "<br />").replace("\n", "<br />").split("<br />")%} - <p>{{line}}</p> - {%endfor%} - </td> - </tr> - </table> -</div> - -<div class="row"> - <p>If you are sure that is what you want, click the button below to delete the - publication</p> - <p class="form-text text-small"> - <small>You will not be able to recover the data if you click - delete below.</small></p> - - <form action="{{url_for('publications.delete_publication', publication_id=publication_id)}}" - method="POST"> - <div class="form-group"> - <input type="submit" value="delete" class="btn btn-danger" /> - </div> - </form> -</div> -{%endblock%} - - -{%block javascript%} -<script type="text/javascript"> - $(function() {}); -</script> -{%endblock%} diff --git a/uploader/templates/publications/sui-edit-publication.html b/uploader/templates/publications/sui-edit-publication.html deleted file mode 100644 index 847b020..0000000 --- a/uploader/templates/publications/sui-edit-publication.html +++ /dev/null @@ -1,203 +0,0 @@ -{%extends "publications/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}Edit Publication{%endblock%} - -{%block breadcrumbs%} -{{super()}} -<li class="breadcrumb-item"> - <a href="{{url_for('publications.edit_publication', - publication_id=publication.Id)}}" - title="Edit the publication's details">edit publication</a> -</li> -{%endblock%} - - -{%block contents%} -{{flash_all_messages()}} - -<div class="row"> - <form id="frm-create-publication" - method="POST" - action="{{url_for('publications.edit_publication', - publication_id=publication_id, - next=request.args.get('next', ''))}}" - class="form-horizontal"> - - <div class="row mb-3"> - <label for="txt-pubmed-id" class="col-sm-2 col-form-label"> - PubMed ID</label> - <div class="col-sm-10"> - <div class="input-group"> - <input type="text" - id="txt-pubmed-id" - name="pubmed-id" - value="{{publication.PubMed_ID or ''}}" - class="form-control" /> - <div class="input-group-text"> - <button class="btn btn-outline-primary" - id="btn-search-pubmed-id">search</button> - </div> - </div> - <span id="search-pubmed-id-error" - class="form-text text-muted text-danger visually-hidden"> - </span> - <span class="form-text text-muted">This is the publication's ID on - <a href="https://pubmed.ncbi.nlm.nih.gov/" - title="Link to NCBI's PubMed service">NCBI's Pubmed Service</a> - </span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-publication-title" class="col-sm-2 col-form-label"> - Title</label> - <div class="col-sm-10"> - <input type="text" - id="txt-publication-title" - name="publication-title" - value="{{publication.Title}}" - class="form-control" /> - <span class="form-text text-muted">Provide the publication's title here.</span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-publication-authors" class="col-sm-2 col-form-label"> - Authors</label> - <div class="col-sm-10"> - <input type="text" - id="txt-publication-authors" - name="publication-authors" - value="{{publication.Authors}}" - required="required" - class="form-control" /> - <span class="form-text text-muted"> - A publication <strong>MUST</strong> have an author. You <em>must</em> - provide a value for the authors field. - </span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-publication-journal" class="col-sm-2 col-form-label"> - Journal</label> - <div class="col-sm-10"> - <input type="text" - id="txt-publication-journal" - name="publication-journal" - value="{{publication.Journal}}" - class="form-control" /> - <span class="form-text text-muted">Provide the name journal where the - publication was done, here.</span> - </div> - </div> - - <div class="row mb-3"> - <label for="select-publication-month" - class="col-sm-2 col-form-label"> - Month</label> - <div class="col-sm-4"> - <select class="form-control" - id="select-publication-month" - name="publication-month"> - <option value="">Select a month</option> - {%for month in ("january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"):%} - <option value="{{month}}" - {%if publication.Month | lower == month %} - selected="selected" - {%endif%}> - {{month | title}} - </option> - {%endfor%} - </select> - <span class="form-text text-muted">Month of publication</span> - </div> - - <label for="txt-publication-year" - class="col-sm-2 col-form-label"> - Year</label> - <div class="col-sm-4"> - <input type="number" - id="txt-publication-year" - name="publication-year" - value="{{publication.Year}}" - class="form-control" - min="1960" /> - <span class="form-text text-muted">Year of publication</span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-publication-volume" - class="col-sm-2 col-form-label"> - Volume</label> - <div class="col-sm-4"> - <input type="text" - id="txt-publication-volume" - name="publication-volume" - value="{{publication.Volume}}" - class="form-control"> - <span class="form-text text-muted">Journal volume</span> - </div> - - <label for="txt-publication-pages" - class="col-sm-2 col-form-label"> - Pages</label> - <div class="col-sm-4"> - <input type="text" - id="txt-publication-pages" - name="publication-pages" - value="{{publication.Pages}}" - class="form-control" /> - <span class="form-text text-muted">Journal pages for the publication</span> - </div> - </div> - - <div class="row mb-3"> - <label for="txt-abstract" class="col-sm-2 col-form-label">Abstract</label> - <div class="col-sm-10"> - <textarea id="txt-publication-abstract" - name="publication-abstract" - class="form-control" - rows="7">{{publication.Abstract or ""}}</textarea> - </div> - </div> - - <div class="row mb-3"> - <div class="col-sm-2"></div> - <div class="col-sm-8"> - <input type="submit" class="btn btn-primary" value="Save" /> - <input type="reset" class="btn btn-danger" /> - </div> - </div> - -</form> -</div> - -{%endblock%} - - -{%block javascript%} -<script type="text/javascript" src="/static/js/pubmed.js"></script> -<script type="text/javascript"> - $(function() { - $("#btn-search-pubmed-id").on("click", (event) => { - event.preventDefault(); - var search_button = event.target; - var pubmed_id = $("#txt-pubmed-id").val().trim(); - remove_class($("#txt-pubmed-id").parent(), "has-error"); - if(pubmed_id == "") { - add_class($("#txt-pubmed-id").parent(), "has-error"); - return false; - } - - search_button.disabled = true; - // Fetch publication details - fetch_publication_details(pubmed_id, - [() => {search_button.disabled = false;}]); - return false; - }); - }); -</script> -{%endblock%} diff --git a/uploader/templates/publications/sui-index.html b/uploader/templates/publications/sui-index.html deleted file mode 100644 index e405dd1..0000000 --- a/uploader/templates/publications/sui-index.html +++ /dev/null @@ -1,109 +0,0 @@ -{%extends "publications/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}Publications{%endblock%} - - -{%block contents%} -{{flash_all_messages()}} - -<div class="row" style="padding-bottom: 1em;"> - <div class="col"> - <a href="{{url_for('publications.create_publication')}}" - class="btn btn-primary" - title="Create a new publication."> - add new publication</a> - </div> -</div> - -<div class="row"> - <p>Click on title to view more details and to edit details for that - publication.</p> -</div> - -<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" src="/static/js/urls.js"></script> - -<script type="text/javascript"> - $(function() { - var publicationsDataTable = buildDataTable( - "#tbl-list-publications", - [], - [ - {data: "index"}, - { - searchable: true, - data: (pub) => { - if(pub.PubMed_ID) { - return `<a href="https://pubmed.ncbi.nlm.nih.gov/` + - `${pub.PubMed_ID}/" target="_blank" ` + - `title="Link to publication on NCBI.">` + - `${pub.PubMed_ID}</a>`; - } - return ""; - } - }, - { - searchable: true, - data: (pub) => { - var title = "⸻"; - if(pub.Title) { - title = pub.Title - } - url=buildURLFromCurrentURL( - `/publications/view/${pub.Id}`); - return `<a href="${url}" target="_blank" ` + - `title="Link to view publication details">` + - `${title}</a>`; - } - }, - { - searchable: true, - data: (pub) => { - authors = pub.Authors.split(",").map( - (item) => {return item.trim();}); - if(authors.length > 1) { - return authors[0] + ", et. al."; - } - return authors[0]; - } - } - ], - { - serverSide: true, - ajax: { - url: "/publications/list", - dataSrc: "publications" - }, - scrollY: 700, - scroller: true, - scrollCollapse: true, - paging: true, - deferRender: true, - layout: { - topStart: "info", - topEnd: "search", - bottomStart: "pageLength", - bottomEnd: false - } - }); - }); -</script> -{%endblock%} diff --git a/uploader/templates/publications/sui-view-publication.html b/uploader/templates/publications/sui-view-publication.html deleted file mode 100644 index 740fc37..0000000 --- a/uploader/templates/publications/sui-view-publication.html +++ /dev/null @@ -1,80 +0,0 @@ -{%extends "publications/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}View Publication{%endblock%} - - -{%block contents%} -{{flash_all_messages()}} - -<div class="row"> - <table class="table"> - <tr> - <th>Linked Phenotypes</th> - <td>{{linked_phenotypes | count}}</td> - </tr> - <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> - {%for line in (publication.Abstract or "—").replace("\r\n", "<br />").replace("\n", "<br />").split("<br />")%} - <p>{{line}}</p> - {%endfor%} - </td> - </tr> - </table> -</div> - -<div class="row"> - <div> - <a href="{{url_for('publications.edit_publication', publication_id=publication.Id)}}" - title="Edit details for this publication." - class="btn btn-primary">Edit</a> - {%if linked_phenotypes | length == 0%} - <a href="{{url_for('publications.delete_publication', publication_id=publication.Id)}}" - class="btn btn-danger">delete</a> - {%endif%} - </div> -</div> -{%endblock%} - - -{%block javascript%} -<script type="text/javascript"> - $(function() {}); -</script> -{%endblock%} diff --git a/uploader/templates/publications/view-publication.html b/uploader/templates/publications/view-publication.html index 0bd7bc5..01ccf1e 100644 --- a/uploader/templates/publications/view-publication.html +++ b/uploader/templates/publications/view-publication.html @@ -3,8 +3,6 @@ {%block title%}View Publication{%endblock%} -{%block pagetitle%}View Publication{%endblock%} - {%block contents%} {{flash_all_messages()}} |
