Commit 3cc5752b authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add icons for physicochemical rules compliance in compounds list

as requested in #251
parent 260b8088
Pipeline #41736 failed with stages
in 11 minutes and 21 seconds
{% load customtags %}
<div class="row m-2 border border-info bg-light border_card" style="box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.2);"> <div class="row m-2 border border-info bg-light border_card" style="box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.2);">
{%if show_detail != True %} {%if show_detail != True %}
<div class="col-sm-3 border-info d-flex justify-content-center align-content-center {% if compound.replaced_with or compound.is_validated is False %}bg_warning{% endif %}"> <div class="col-sm-3 border-info d-flex justify-content-center align-content-center {% if compound.replaced_with or compound.is_validated is False %}bg_warning{% endif %}">
...@@ -8,6 +10,11 @@ ...@@ -8,6 +10,11 @@
{% if compound.tanimoto != None %} {% if compound.tanimoto != None %}
<h2 class="position-absolute" style="top:0.3em; right:0.3em;" title="tanimoto similarity value"><span class="badge badge-light text-warning">{{ compound.tanimoto }}</span></h2> <h2 class="position-absolute" style="top:0.3em; right:0.3em;" title="tanimoto similarity value"><span class="badge badge-light text-warning">{{ compound.tanimoto }}</span></h2>
{% endif %} {% endif %}
<h2 class="position-absolute" style="top:270px; left:0.3em;"><span class="badge badge-light">
{% rule_status_icon compound.lipinsky "Lipinski's RO5" %}
{% rule_status_icon compound.veber "Veber" %}
{% rule_status_icon compound.pfizer "Pfizer" %}
</h2>
</div> </div>
{% endif %} {% endif %}
<div class="{%if show_detail != True %}col-sm-9{% else %}col-sm-12{% endif %}"> <div class="{%if show_detail != True %}col-sm-9{% else %}col-sm-12{% endif %}">
......
...@@ -28,6 +28,19 @@ def status_class(value): ...@@ -28,6 +28,19 @@ def status_class(value):
else: else:
return "table-secondary" return "table-secondary"
@register.simple_tag
def rule_status_icon(value, title):
if value is True:
class_suffix = 'success'
icon_suffix = 'check'
elif value is False:
class_suffix = 'danger'
icon_suffix = 'times'
else:
class_suffix = 'secondary'
class_suffix = 'question'
return mark_safe(f'<i class="fas fa-{icon_suffix} text-{class_suffix}" title="{title}: failed"></i>')
@register.filter @register.filter
def bootstrap(object): def bootstrap(object):
......
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