Skip to content

Commit

Permalink
Adding deep linking into case details tab (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Feb 8, 2022
1 parent 7c82f98 commit 147d5ac
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Expand Up @@ -95,6 +95,7 @@ Full Change List
- Adding more postgres versions to CI (#337)
- Make migrations compatible with Postgres 14 (#338)
- DgvSvs and DgvGoldStandardSvs are two different data sources now
- Adding deep linking into case details tab (#344)

-------
v0.23.9
Expand Down
26 changes: 26 additions & 0 deletions variants/templates/variants/case_detail.html
Expand Up @@ -133,6 +133,32 @@ <h2 class="sodar-pr-content-title">
{% block javascript %}
{{ block.super }}
<script type="text/javascript">

// Properly open tabs.
$(document).ready(() => {
let url = location.href.replace(/\/$/, "");

if (location.hash) {
const hash = url.split("#");
$('#case-tab a[href="#'+hash[1]+'"]').tab("show");
history.replaceState(null, null, url);
setTimeout(() => {
$(window).scrollTop(0);
}, 400);
}

$('a[data-toggle="tab"]').on("click", function() {
let newUrl;
const hash = $(this).attr("href");
if(hash == "#home") {
newUrl = url.split("#")[0];
} else {
newUrl = url.split("#")[0] + hash;
}
history.replaceState(null, null, newUrl);
});
});

// Load data after the page has loaded
$(function() {
axios.get("/variants/{{ object.project.sodar_uuid }}/case/api-qc/{{ object.sodar_uuid }}/")
Expand Down

0 comments on commit 147d5ac

Please sign in to comment.