From 3c9cdfc7bc4f321317575251b2d7633b10a49950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr> Date: Fri, 20 Jul 2018 11:47:43 +0200 Subject: [PATCH] tweak display of the compounds list again flexboxes, flexboxes everywhere ;) Former-commit-id: 84a5812af913d28e653097f43bb88fe0bfdfb6a5 --- ippisite/ippidb/templates/compound_list.html | 2 ++ ippisite/ippidb/templates/compound_v_item.html | 4 +++- ippisite/ippidb/templates/pubchem_img.html | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ippisite/ippidb/templates/compound_list.html b/ippisite/ippidb/templates/compound_list.html index 7aa032fb..ae0bd196 100644 --- a/ippisite/ippidb/templates/compound_list.html +++ b/ippisite/ippidb/templates/compound_list.html @@ -91,9 +91,11 @@ {% if compounds %} <div class="container-fluid"> {% if display == 'v' %} + <div class="d-flex flex-wrap m-2 justify-content-around"> {% for compound in compounds %} {% include "compound_v_item.html" with compound=compound %} {% endfor %} + </div> {% elif display == 'l'%} {% for compound in compounds %} {% include "compound_l_item.html" with compound=compound %} diff --git a/ippisite/ippidb/templates/compound_v_item.html b/ippisite/ippidb/templates/compound_v_item.html index 6f22bebd..d487ba82 100644 --- a/ippisite/ippidb/templates/compound_v_item.html +++ b/ippisite/ippidb/templates/compound_v_item.html @@ -1,4 +1,5 @@ -<div class="card m-2 border border-info" style="width: 300px"> +<div class="p-2"> +<div class="card border border-info"> <a href="/compounds/{{ compound.id }}">{% include "pubchem_img.html" %}</a> <div class="card-body" style="overflow:hidden; word-wrap:break-word;"> <span class="badge badge-dark"><a href="/compounds/{{ compound.id }}">{{ compound.id }}</a></span> @@ -6,3 +7,4 @@ <p>Molecular Weight: {{ compound.molecular_weight }} g/mol</p> </div> </div> +</div> diff --git a/ippisite/ippidb/templates/pubchem_img.html b/ippisite/ippidb/templates/pubchem_img.html index 622ee2ca..ecb1a04d 100644 --- a/ippisite/ippidb/templates/pubchem_img.html +++ b/ippisite/ippidb/templates/pubchem_img.html @@ -1 +1 @@ -<img src="https://pubchem.ncbi.nlm.nih.gov/image/imagefly.cgi?cid={{ compound.pubchem_id }}&width=300&height=300" style="width:290px;height:290px;" onerror="this.src='/static/images/cross.svg';"/> +<img src="https://pubchem.ncbi.nlm.nih.gov/image/imagefly.cgi?cid={{ compound.pubchem_id }}&width=300&height=300" onerror="this.src='/static/images/cross.svg'; this.style.width='300px';"/> -- GitLab