Files
rar-autopass/app/web/templates/_header_env_badge.html
Claude Agent a46e364594 feat(header): badge mediu RAR compact langa chip-ul RAR
Muta indicatorul de mediu (Testare/PRODUCTIE) din statusbar (randare
periodica, rand intreg) intr-un badge compact din header, langa chipul
RAR scurtat la "RAR". Click pe badge comuta mediul cand exista 2
disponibile; pe mobil (<=560px) eticheta scurta PROD/TEST ramane mereu
vizibila (semnal de risc L.142). Toggle-ul din header si schimbarea
mediului implicit din Setari actualizeaza badge-ul via OOB swap.

Co-Authored-By: Claude Agent <noreply@anthropic.com>
2026-07-06 21:15:12 +00:00

30 lines
1.2 KiB
HTML

{# Badge compact "Mediu RAR" din header, langa chip-ul RAR.
0 medii: wrapper gol (id-ul ramane in DOM pentru viitoare OOB swap).
1 mediu: eticheta statica. 2 medii: buton de comutare HTMX (ciclic).
Clasele .env-badge-prod/.env-badge-test sunt cele din listele de trimiteri (consecventa). #}
{% set _medii = medii_disponibile | default([]) %}
<div id="header-env-badge"{% if oob %} hx-swap-oob="outerHTML"{% endif %}>
{% if _medii | length >= 1 %}
{% set _env = env_default | default('prod') %}
{% set _eb = eticheta_env(_env) %}
{% set _scurt = 'PROD' if _env == 'prod' else 'TEST' %}
{% if _medii | length >= 2 %}
<button type="button" class="{{ _eb[1] }}"
style="cursor:pointer;"
hx-post="/_fragments/status/toggle-env"
hx-target="#header-env-badge"
hx-swap="outerHTML"
hx-vals='{"csrf_token": {{ csrf_token | tojson }}}'
title="Comuta la {{ 'Testare' if _env == 'prod' else 'PRODUCȚIE' }}">
<span class="env-tx-full">{{ _eb[0] }}</span>
<span class="env-tx-short">{{ _scurt }}</span>
</button>
{% else %}
<span class="{{ _eb[1] }}">
<span class="env-tx-full">{{ _eb[0] }}</span>
<span class="env-tx-short">{{ _scurt }}</span>
</span>
{% endif %}
{% endif %}
</div>