diff --git a/ippisite/ippidb/templates/compound_list.html b/ippisite/ippidb/templates/compound_list.html index 41f9c97d504cfb4d60d55a8a6aa5b2535cb43d80..accb82843d65aed6f7d84f5e81c1979d27cb8dae 100644 --- a/ippisite/ippidb/templates/compound_list.html +++ b/ippisite/ippidb/templates/compound_list.html @@ -40,7 +40,8 @@ <main class="col-12 col-md-9 col-xl-10 pl-md-5 bd-content" role="main"> <form> - <div class="row m-2 border border-bg-light"><span>{{ count }} compounds</span> + <div class=""> + <span class="m-2"><span>{{ count }} compounds</span> {% if selected_ppis or selected_diseases or selected_taxonomies or selected_boundcomplexes %} <span> - filters: </span> {% if selected_ppis %} @@ -64,10 +65,19 @@ {% endfor %} {% endif %} {% endif %} + </span> + <span class="btn-group float-right"> + <a class="btn btn-default btn-outline-primary {% if not display_list %}active{% endif %}" href="#" {% if display_list %}onclick="modifyUrl('display_list', null)"{% endif %}> + <i class="fa fa-th" title="Vignettes"></i> + </a> + <a class="btn btn-default btn-outline-primary {% if display_list %}active{% endif %}" href="#" {% if not display_list %}onclick="modifyUrl('display_list', true)"{% endif %}> + <i class="fa fa-bars" title="List"></i> + </a> + </span> </div> </form> {% if compounds %} - {% if display_table %} + {% if display_list %} {% for compound in compounds %} {% include "compound_table_item.html" with compound=compound %} {% endfor %} diff --git a/ippisite/ippidb/views.py b/ippisite/ippidb/views.py index 235eea2e3133b38640595d26b0f2ce7405bad795..c1753120304a7bae872b91b6c491cf765d05e7d7 100644 --- a/ippisite/ippidb/views.py +++ b/ippisite/ippidb/views.py @@ -211,6 +211,7 @@ 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) + display_list = request.GET.get('display_list') return render(request, 'compound_list.html', {'compounds': compounds, 'count': count, 'selected_ppis': selected_ppis, @@ -224,7 +225,8 @@ def compound_list(request): 'taxonomies_all': taxonomies_all, 'selected_boundcomplexes': selected_boundcomplexes, 'boundcomplexes': boundcomplexes, - 'boundcomplexes_all': boundcomplexes_all + 'boundcomplexes_all': boundcomplexes_all, + 'display_list': display_list }) def compound_card(request, compound_id):