Commit 4d26c3ad authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add badges for filters and matches count in compounds list (WIP)


Former-commit-id: 20733216244f5b9ba737f1d8cd52c009199e92b6
parent 80a8933e
......@@ -40,7 +40,33 @@
{% include "multiselection_list_menu.html" with label="Bound complex" selected_list=selected_boundcomplexes unselected_list=boundcomplexes param_name="boundcomplex" all_param_name="boundcomplexes_all" all_param_value=boundcomplexes_all %}
</form>
</div>
<main class="col-12 col-md-9 col-xl-10 pl-md-5 bd-content" role="main">
<div class="row m-2 border border- bg-light"><span>{{ count }} compounds</span>
{% if selected_ppis or selected_diseases or selected_taxonomies or selected_boundcomplexes %}
<span>&nbsp;-&nbsp;filters:&nbsp;</span>
{% if selected_ppis %}
{% for selected in selected_ppis %}
<span class="badge badge-info" style="font-size: 100%">{{ selected.name }}</span>&nbsp;
{% endfor %}
{% endif %}
{% if selected_diseases %}
{% for selected in selected_diseases %}
<span class="badge badge-info" style="font-size: 100%">{{ selected.name }}</span>&nbsp;
{% endfor %}
{% endif %}
{% if selected_taxonomies %}
{% for selected in selected_taxonomies %}
<span class="badge badge-info" style="font-size: 100%">{{ selected.name }}</span>&nbsp;
{% endfor %}
{% endif %}
{% if selected_boundcomplexes %}
{% for selected in selected_boundcomplexes %}
<span class="badge badge-info" style="font-size: 100%">{{ selected.name }}</span>&nbsp;
{% endfor %}
{% endif %}
{% endif %}
</div>
{% if compounds %}
{% for compound in compounds %}
{% include "compound_abstract.html" with compound=compound %}
......
......@@ -219,6 +219,7 @@ def compound_list(request):
boundcomplexes = ProteinDomainBoundComplex.objects.exclude(id__in=request.GET.getlist('boundcomplex'))
if boundcomplexes_all is None:
boundcomplexes = boundcomplexes[:5]
count = compounds.count()
# handle pagination in compounds list
paginator = Paginator(compounds, 5)
page = request.GET.get('page')
......@@ -230,7 +231,8 @@ def compound_list(request):
except EmptyPage:
# If page is out of range (e.g. 9999), deliver last page of results.
compounds = paginator.page(paginator.num_pages)
return render(request, 'compound_list.html', {'compounds': compounds,
return render(request, 'compound_list.html', {'compounds': compounds,
'count': count,
'selected_ppis': selected_ppis,
'ppis': ppis,
'ppis_all': ppis_all,
......
Supports Markdown
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