fix(options): skip empty category tabs (Prompt S)

When building the tab list, resolve each category's option keys first
(after excluding the top-of-page keys and ajaxmode) and only add the tab
when at least one option remains. The "Progress" category's only option
(progressbarposition) lives in the Top-of-page tab, so the empty
Progress tab and pane are no longer rendered. Generic: any future
emptied category disappears too. No config.xml change, no variant
rebuild, no theme reset. Verified via CLI render (row 270): no
category-progress tab/pane, 6 tabs remain, all 63 option wrappers
present, progressbarposition + the 3 progressbar colors render exactly
once, in the top-of-page pane.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-24 22:57:43 +01:00
commit 53b1786949

View file

@ -164,7 +164,18 @@
{% set aTabs = aTabs|merge([{ 'id': 'top-of-page', 'label': 'Top of the page', 'category': 'Top of the page', 'keys': aTopOfPageKeys }]) %} {% set aTabs = aTabs|merge([{ 'id': 'top-of-page', 'label': 'Top of the page', 'category': 'Top of the page', 'keys': aTopOfPageKeys }]) %}
{% for category in aOptionAttributes.categories %} {% for category in aOptionAttributes.categories %}
{% if category != 'Fonts' and category != 'Top of the page' %} {% if category != 'Fonts' and category != 'Top of the page' %}
{% set aTabs = aTabs|merge([{ 'id': 'category-' ~ category|lower|replace({' ': '-'}), 'label': category, 'category': category, 'keys': null }]) %} {# Resolve this category's keys once and skip the tab entirely when none
remain (Prompt S): e.g. "Progress" — its only option (progressbarposition)
moved to the Top-of-page tab, so an empty tab must not be rendered. #}
{% set catKeys = [] %}
{% for key, attr in aOptionAttributes.optionAttributes %}
{% if key != 'ajaxmode' and attr.category == category and key not in aTopOfPageKeys %}
{% set catKeys = catKeys|merge([key]) %}
{% endif %}
{% endfor %}
{% if catKeys is not empty %}
{% set aTabs = aTabs|merge([{ 'id': 'category-' ~ category|lower|replace({' ': '-'}), 'label': category, 'category': category, 'keys': null }]) %}
{% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}