byceps/blueprints/common/core/templates/macros/misc.html
{%- from 'macros/icons.html' import render_icon %}
{% macro render_distribution_bar(values_and_classes, total) -%}
<div class="progress{% if total %} progress--separated{% endif %}">
{%- for value, class in values_and_classes %}
{%- if value %}
{{ render_progress_bar(value, total, class) }}
{%- endif %}
{%- endfor %}
</div>
{%- endmacro %}
{% macro render_progress_bar(value, total, class=None) -%}
<div class="progress-bar{% if class is not none %} {{ class }}{% endif %}" style="width: calc(100% * {{ value }} / {{ total }});"></div>
{%- endmacro %}
{% macro render_notification(text, category=None, icon=None) -%}
{%- call render_notification_block(category=category, icon=icon) -%}
{{ text }}
{%- endcall %}
{%- endmacro %}
{% macro render_notification_block(category=None, icon=None) -%}
<div class="notification{% if category %} color-{{ category }}{% endif %} block-with-icon">
<div class="block-with-icon-icon">
{%- if icon %}
{{ render_icon(icon) }}
{%- else %}
<span class="icon"></span>
{%- endif %}
</div>
<div class="block-with-icon-body">
{{ caller() }}
</div>
</div>
{%- endmacro %}
{% macro render_tag(label, class=None, icon=None, title=None) -%}
<span class="tag{% if class is not none %} {{ class }}{% endif %}"
{%- if title %} title="{{ title }}"{% endif -%}
>
{%- if icon %}{{ render_icon(icon) }} {% endif %}{{ label -}}
</span>
{%- endmacro %}