Skip to content
Snippets Groups Projects
Commit 6a9bd778 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

correct behavior of "selected" badges in compound query

Former-commit-id: db89cc1679ff6b98144a467586a68dedcde79138
parent af936c05
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/css/ippidb.css"> <link rel="stylesheet" href="/static/css/ippidb.css">
<script src="/static/jquery/jquery-3.3.1.min.js"></script> <script src="/static/jquery/jquery-3.3.1.min.js"></script>
<script src="/static/popper/popper.min.js"></script> <script src="/static/popper/popper.min.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script> <script src="/static/bootstrap/js/bootstrap.min.js"></script>
...@@ -38,7 +38,12 @@ ...@@ -38,7 +38,12 @@
var changeSelection = function(paramName){ var changeSelection = function(paramName){
var selectedFields = $('input[name='+ paramName +']:checked').map(function(_, el) { return $(el).val(); }).get(); var selectedFields = $('input[name='+ paramName +']:checked').map(function(_, el) { return $(el).val(); }).get();
modifyUrl(paramName, selectedFields); 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> </script>
</head> </head>
......
...@@ -44,22 +44,22 @@ ...@@ -44,22 +44,22 @@
<span>&nbsp;-&nbsp;filters:&nbsp;</span> <span>&nbsp;-&nbsp;filters:&nbsp;</span>
{% if selected_ppis %} {% if selected_ppis %}
{% for selected in 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 %} {% endfor %}
{% endif %} {% endif %}
{% if selected_diseases %} {% if selected_diseases %}
{% for selected in 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 %} {% endfor %}
{% endif %} {% endif %}
{% if selected_taxonomies %} {% if selected_taxonomies %}
{% for selected in 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 %} {% endfor %}
{% endif %} {% endif %}
{% if selected_boundcomplexes %} {% if selected_boundcomplexes %}
{% for selected in 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 %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}
......
<span class="badge badge-info" style="font-size: 100%">{{ selected.name }} <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>&nbsp; </span>&nbsp;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment