diff --git a/ippisite/ippidb/templates/base.html b/ippisite/ippidb/templates/base.html index cc89079ad8119c61bfdd2a3cac9f09cd4423fe0b..47710d4f5da2f64ee7f4717ece428d1d7431b36e 100644 --- a/ippisite/ippidb/templates/base.html +++ b/ippisite/ippidb/templates/base.html @@ -8,7 +8,7 @@ <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="/static/css/ippidb.css"> - + <script src="/static/jquery/jquery-3.3.1.min.js"></script> <script src="/static/popper/popper.min.js"></script> <script src="/static/bootstrap/js/bootstrap.min.js"></script> @@ -38,7 +38,12 @@ var changeSelection = function(paramName){ var selectedFields = $('input[name='+ paramName +']:checked').map(function(_, el) { return $(el).val(); }).get(); modifyUrl(paramName, selectedFields); - } + } + var removeFromSelection = function(paramName, value){ + var selectedFields = $('input[name='+ paramName +']:checked').map(function(_, el) { return $(el).val(); }).get(); + selectedFields.remove(value); + modifyUrl(paramName, selectedFields); + } </script> </head> diff --git a/ippisite/ippidb/templates/compound_list.html b/ippisite/ippidb/templates/compound_list.html index 21abc5ec12c60c82a8a5759a6b6621caf7fbcb8e..18ec47ec5be4937952d79fe1465adf2bbe5dfcb0 100644 --- a/ippisite/ippidb/templates/compound_list.html +++ b/ippisite/ippidb/templates/compound_list.html @@ -44,22 +44,22 @@ <span> - filters: </span> {% if selected_ppis %} {% for selected in selected_ppis %} - {% include "selected_badge.html" with selected=selected %} + {% include "selected_badge.html" with param_name="ppi" selected=selected %} {% endfor %} {% endif %} {% if selected_diseases %} {% for selected in selected_diseases %} - {% include "selected_badge.html" with selected=selected %} + {% include "selected_badge.html" with param_name="disease" selected=selected %} {% endfor %} {% endif %} {% if selected_taxonomies %} {% for selected in selected_taxonomies %} - {% include "selected_badge.html" with selected=selected %} + {% include "selected_badge.html" with param_name="taxonomy" selected=selected %} {% endfor %} {% endif %} {% if selected_boundcomplexes %} {% for selected in selected_boundcomplexes %} - {% include "selected_badge.html" with selected=selected %} + {% include "selected_badge.html" with param_name="boundcomplex" selected=selected %} {% endfor %} {% endif %} {% endif %} diff --git a/ippisite/ippidb/templates/selected_badge.html b/ippisite/ippidb/templates/selected_badge.html index d5a69cace79b1412a8f4f881f202c1f5456b6d05..69f8955b7a92ac252085a32e1b573b3648b27134 100644 --- a/ippisite/ippidb/templates/selected_badge.html +++ b/ippisite/ippidb/templates/selected_badge.html @@ -1,3 +1,3 @@ <span class="badge badge-info" style="font-size: 100%">{{ selected.name }} - <a href="#" style="color: white;" onclick="$('#selected-{{ selected.id}}')[0].click();"><i class="remove fa fa-times-circle"></i></a> + <a href="#" style="color: white;" onclick="removeFromSelection('{{ param_name }}', '{{ selected.id }}')"><i class="remove fa fa-times-circle"></i></a> </span>