2025-01-31 14:46:50 +01:00
{% macro badge(check=none, url=none, solo=false, last=false, header=false, color='primary', rgb=none, blank=none, icon=none, alt=none, collapsible=none, text=none, tooltip=none) %}
2025-01-17 11:03:00 +01:00
{% if check or url %}
{% if url %}
< a href = "{{ url }}" { % if blank % } target = "_blank" { % endif % }
{% else %}
< span
{% endif %}
2025-01-31 14:46:50 +01:00
class="badge text-bg-{{ color }} fw-normal {% if not header %}mb-1{% endif %} {% if solo and not header %}fs-6{% endif %}" {% if alt %}alt="{{ alt }}"{% endif %}
2025-01-17 11:03:00 +01:00
{% if tooltip %} data-bs-toggle="tooltip" title="{{ tooltip }}"{% endif %}
>
{% if icon %}< i class = "ri-{{ icon }}" > < / i > {% endif %}
2025-01-31 14:46:50 +01:00
{% if rgb %}< span class = "color-rgb {% if rgb == 'any' %}color-any{% endif %} align-bottom border border-black" { % if rgb ! = ' any ' % } style = "background-color: #{{ rgb }};" { % endif % } > < / span > {% endif %}
2025-01-17 11:03:00 +01:00
{% if collapsible and not last %}< span { % if not solo % } class = "d-none d-md-inline" { % endif % } > {{ collapsible }} < / span > {% endif %}
{% if text %}{{ text }}{% endif %}
{% if url %}
< / a >
{% else %}
< / span >
{% endif %}
{% endif %}
{% endmacro %}
{% macro bricklink(item, solo=false, last=false) %}
{{ badge(url=item.url_for_bricklink(), solo=solo, last=last, blank=true, color='light border', icon='external-link-line', collapsible='Bricklink', alt='Bricklink') }}
{% endmacro %}
2025-01-31 14:46:50 +01:00
{% macro color(item, icon=none, solo=false, last=false, header=false) %}
{% if item.fields.color == 9999 %}
{% set rgb = 'any' %}
{% else %}
{% set rgb = item.fields.color_rgb %}
{% endif %}
{{ badge(check=item.fields.color_name, solo=solo, last=last, header=header, color=' bg-white text-black border', rgb=rgb, icon='palette-line', collapsible=item.fields.color_name) }}
{{ badge(check=item.fields.color_transparent, solo=solo, last=last, header=header, color='light border', icon='blur-off-line', collapsible='Transparent') }}
{% endmacro %}
{% macro identifier(id, icon=none, solo=false, last=false, header=false) %}
{{ badge(check=id, solo=solo, last=last, header=header, color='secondary', icon=icon, text=id) }}
{% endmacro %}
2025-01-17 11:03:00 +01:00
{% macro instructions(item, solo=false, last=false) %}
{{ badge(url=item.url_for_instructions(), solo=solo, last=last, blank=true, color='light border', icon='file-line', collapsible='Instructions:', text=item.instructions | length, alt='Instructions') }}
{% endmacro %}
{% macro parts(parts, solo=false, last=false) %}
{{ badge(check=parts, solo=solo, last=last, color='success', icon='shapes-line', collapsible='Parts:', text=parts, alt='Parts') }}
{% endmacro %}
{% macro quantity(quantity, solo=false, last=false) %}
{{ badge(check=quantity, solo=solo, last=last, color='success', icon='close-line', collapsible='Quantity:', text=quantity, alt='Quantity') }}
{% endmacro %}
2025-01-31 14:46:50 +01:00
{% macro print(item, solo=false, last=false, header=false) %}
{{ badge(url=item.url_for_print(), solo=solo, last=last, color='light border', icon='paint-brush-line', collapsible='Print') }}
{% endmacro %}
2025-01-17 11:03:00 +01:00
{% macro set(set, solo=false, last=false, url=None, id=None) %}
{% if id %}
{% set url=url_for('set.details', id=id) %}
{% endif %}
{{ badge(check=set, url=url, solo=solo, last=last, color='secondary', icon='hashtag', collapsible='Set:', text=set, alt='Set') }}
{% endmacro %}
{% macro theme(theme, solo=false, last=false) %}
{% if last %}
{% set tooltip=theme %}
{% else %}
{% set text=theme %}
{% endif %}
{{ badge(check=theme, solo=solo, last=last, color='primary', icon='price-tag-3-line', text=text, alt='Theme', tooltip=tooltip) }}
{% endmacro %}
{% macro total_quantity(quantity, solo=false, last=false) %}
{{ badge(check=quantity, solo=solo, last=last, color='success', icon='functions', collapsible='Quantity:', text=quantity, alt='Quantity') }}
{% endmacro %}
{% macro total_minifigures(minifigures, solo=false, last=false) %}
{{ badge(check=minifigures, solo=solo, last=last, color='info', icon='group-line', collapsible='Minifigures:', text=minifigures, alt='Minifigures') }}
{% endmacro %}
{% macro total_missing(missing, solo=false, last=false) %}
{{ badge(check=missing, solo=solo, last=last, color='danger', icon='error-warning-line', collapsible='Missing:', text=missing, alt='Missing') }}
{% endmacro %}
{% macro total_sets(sets, solo=false, last=false) %}
{{ badge(check=sets, solo=solo, last=last, color='secondary', icon='hashtag', collapsible='Sets:', text=sets, alt='Sets') }}
{% endmacro %}
{% macro total_spare(spare, solo=false, last=false) %}
{{ badge(check=spare, solo=solo, last=last, color='warning', icon='loop-left-line', collapsible='Spare:', text=spare, alt='Spare') }}
{% endmacro %}
{% macro rebrickable(item, solo=false, last=false) %}
{{ badge(url=item.url_for_rebrickable(), solo=solo, last=last, blank=true, color='light border', icon='external-link-line', collapsible='Rebrickable', alt='Rebrickable') }}
{% endmacro %}
{% macro year(year, solo=false, last=false) %}
{{ badge(check=year, solo=solo, last=last, color='secondary', icon='calendar-line', collapsible='Year:', text=year, alt='Year') }}
{% endmacro %}