{% load i18n %}
{% load l10n %}
{% comment %}
Everything inside one face's - shared by the on-page elevation
(inc/elevation.html) and the standalone SVG export (elevation_export.html), so the
two never drift apart. Localization is switched off because SVG coordinates must use
a dot as the decimal separator whatever the UI language is.
{% endcomment %}
{% localize off %}
{# Unit rows and legend. An empty unit becomes a click target for adding a device here, exactly like a real rack's elevation. #}
{% for unit in elevation.units %}
{% if not unit.occupied and can_add_device %}
+ {% trans "Add device" %}
{% else %}
{% endif %}
{{ unit.number }}
{% endfor %}
{# Devices #}
{% for block in elevation.blocks %}
{% comment %}
The plain label is always in the markup, image or not - toggling "images
only" just layers the (opaque) image on top of it, exactly like NetBox's
own rack elevation does. That way there is one code path, not two.
{% endcomment %}
{% if block.show_text %}
{{ block.label }}{% if block.opposite %} ({% trans "rear" %}){% endif %}
{% endif %}
{% if block.image %}
{# Absolute when we have a request: an exported file that outlives the page it came from needs a URL that still resolves once saved elsewhere. #}
{% if block.show_text %}
{# Outlined white-on-black text, drawn as a stroke pass then a fill pass, so it reads over any image without a background box. #}
{{ block.label }}
{{ block.label }}
{% endif %}
{% endif %}
{{ block.label }}{% if block.sublabel %} · {{ block.sublabel }}{% endif %} · U{{ block.device.position }}
{% endfor %}
{% endlocalize %}