diff options
author | Munyoki Kilyungi | 2024-04-02 12:25:35 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-04-02 13:55:15 +0300 |
commit | 7d524ffb5709c7f38ce4ffd5db3235bd2cbc9cb9 (patch) | |
tree | c6f16c4c8857fd9166792d92a6f7867374e4dbac /gn2/wqflask/templates | |
parent | 027659e21b0614967c3401201afd7de8f8d2e7c1 (diff) | |
download | genenetwork2-7d524ffb5709c7f38ce4ffd5db3235bd2cbc9cb9.tar.gz |
Display a history page containing all the edits.
* gn2/wqflask/edit.py (__fetch_dataset_git_history__): New function.
(view_history): New end-point.
* gn2/wqflask/templates/dataset.html: Use htmx to fetch history.
* gn2/wqflask/templates/dataset_history.html: New history page.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn2/wqflask/templates')
-rw-r--r-- | gn2/wqflask/templates/dataset.html | 49 | ||||
-rw-r--r-- | gn2/wqflask/templates/dataset_history.html | 20 |
2 files changed, 46 insertions, 23 deletions
diff --git a/gn2/wqflask/templates/dataset.html b/gn2/wqflask/templates/dataset.html index e4ae34ae..1e2c5bc4 100644 --- a/gn2/wqflask/templates/dataset.html +++ b/gn2/wqflask/templates/dataset.html @@ -73,30 +73,27 @@ {% if dataset %} -<header class="page-header text-justify"> - <h1> - {% if dataset.title or dataset.label or dataset.altLabel %} - {{ dataset.title or dataset.label or dataset.altLabel }} - {% if dataset.title != dataset.altLabel and dataset.label != dataset.altLabel %} - <br/> - <small>({{ dataset.altLabel }})</small> - {% endif %} - {% else %} - {{ name }} - {% endif %} - <small> - <sup> - [ - <a href="" target="_blank"> - View history - </a> - ] - </sup> - </small> - </h1> -</header> - <div class="container dataset-content"> + <header class="page-header text-justify"> + <h1> + {% if dataset.title or dataset.label or dataset.altLabel %} + {{ dataset.title or dataset.label or dataset.altLabel }} + {% if dataset.title != dataset.altLabel and dataset.label != dataset.altLabel %} + <br/> + <small>({{ dataset.altLabel }})</small> + {% endif %} + {% else %} + {{ name }} + {% endif %} + <small> + <sup> + [ + <a hx-get={{ url_for('metadata.view_history', id_=dataset.id.split('/')[-1], name=name, title=(dataset.title or dataset.label or dataset.altLabel)) }} hx-target=".dataset-content" hx-push-url="true" hx-select="#history">History</a> + ] + </sup> + </small> + </h1> + </header> <div class="panel-about panel panel-info panel-metadata text-muted"> <div class="panel-heading"> <strong> @@ -358,3 +355,9 @@ {% endif %} {% endblock %} + +{% block js %} + +<script language="javascript" type="text/javascript" src="{{ url_for('js', filename='htmx.min.js') }}"></script> + +{% endblock %} diff --git a/gn2/wqflask/templates/dataset_history.html b/gn2/wqflask/templates/dataset_history.html new file mode 100644 index 00000000..15105410 --- /dev/null +++ b/gn2/wqflask/templates/dataset_history.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} + +{% block content %} +<section class="container" id="history"> + {% if data.error %} + <p class="lead">There was an error fetching the history.</p> + {% else %} + <table class=" table-condensed"> + <tr> + <th>Age</th> + <th>Commit</th> + <th>Summary</th> + <th>Author</th> + </tr> + {{ data|safe }} + </table> + {% endif %} +</section> + +{% endblock %} |