diff --git a/ippisite/ippidb/templates/base.html b/ippisite/ippidb/templates/base.html index b37f34252bf43b1e40ce8bbb634a4109fc5a2d99..33a953831c7bcd39cec849bf7ee2c76b369fe289 100644 --- a/ippisite/ippidb/templates/base.html +++ b/ippisite/ippidb/templates/base.html @@ -93,7 +93,7 @@ data: radarChartData, options: { scaleLineWidth : 1, pointLabelFontFamily : "'Helvetica Neue'", pointLabelFontSize : 12, scaleOverride : true, scaleSteps : 5, scaleStepWidth : 0.2}}); }; - var drawLeLleBiplotChart = function(canvasId, compoundId, compoundFamily, plotData){ + var drawLeLleBiplotChart = function(canvasId, compoundId, compoundFamily, plotData, tabHash){ var currentCompoundData = []; var currentFamilyData = []; var otherFamiliesData = []; @@ -150,7 +150,7 @@ var datasetIndex = activePoints[0]._datasetIndex; var selectedIndex = activePoints[0]._index; var id = scatterChart.data.datasets[datasetIndex].data[selectedIndex].id; - window.location = '/compound/'+id; + window.location = '/compound/' + id + '#' + tabHash; }; }; </script> diff --git a/ippisite/ippidb/templates/compound_card.html b/ippisite/ippidb/templates/compound_card.html index d9698b7da6c97547fcdfe0deec84269f4cc61f94..600478448175c2668edb7c66f8cce9575da8a4bd 100644 --- a/ippisite/ippidb/templates/compound_card.html +++ b/ippisite/ippidb/templates/compound_card.html @@ -153,8 +153,7 @@ <canvas id="radar"></canvas> <script> - drawCompoundDescriptorRadarChart('radar', {{ compound.molecular_weight }}, {{ compound.a_log_p }}, {{ compound.nb_donor_h }}, {{ compound.nb_acceptor_h }}, {{ compound.tpsa }}, {{ compound.nb_rotatable_bonds }}, {{ compound.nb_benzene_like_rings }}, {{ compound.fsp3 }}, {{ compound.nb_chiral_centers }}); - + drawCompoundDescriptorRadarChart('radar', {{ compound.molecular_weight }}, {{ compound.a_log_p }}, {{ compound.nb_donor_h }}, {{ compound.nb_acceptor_h }}, {{ compound.tpsa }}, {{ compound.nb_rotatable_bonds }}, {{ compound.nb_benzene_like_rings }}, {{ compound.fsp3 }}, {{ compound.nb_chiral_centers }}); </script> </div> </div> @@ -166,7 +165,7 @@ <div class="card-body"> <canvas id="le_lle_biplot"></canvas> <script> - drawLeLleBiplotChart('le_lle_biplot', {{ compound.id }}, '{{ compound.best_pXC50_activity_ppi_name|default_if_none:"No target family identified" }}', {{ biplot_data | safe }}) + drawLeLleBiplotChart('le_lle_biplot', {{ compound.id }}, '{{ compound.best_pXC50_activity_ppi_name|default_if_none:"No target family identified" }}', {{ biplot_data | safe }}, 'v-pills-pharmacology'); </script> </div> </div> @@ -228,4 +227,17 @@ </div> </div> </div> +<script> + $(document).ready(function(){ + var tabHash = document.location.hash; + if(!$(tabHash)){ + tabHash = '#' + $('.nav-link.active')[0].attr('id'); + } + $('[href="'+tabHash+'"]').tab('show'); + }); + $('a.nav-link').on('shown.bs.tab', function (e) { + window.location.hash = e.target.hash; + window.scrollTo(0, 0); + }); +</script> {% endblock %}