Problem/Motivation
Update UI Example template in starterkit according to #3574276: Implement "category" property to organize UI Examples better.
As now we have to loop threw category key.
Proposed resolution
Before :
{% if examples is not empty %}
{# List of available examples with anchor links. #}
{% for example in examples %}
<div class="py-8">
<h2 class="text-3xl font-bold"><a href="{{ url('ui_examples.single', {'name': example.id}) }}">{{ example.label }}</a></h2>
{% if example.description %}
<p>{{ example.description }}</p>
{% endif %}
{% if example.render_links %}
<ul>
{% for link in example.render_links %}
<li>{{ link }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endfor %}
{% endif %}
After :
{% if examples is not empty %}
{% for category_id, category in examples %}
<div class="py-8">
<h2 id="{{ category_id }}" class="text-3xl font-bold">{{ category.label }}</h2>
{% for example in category.examples %}
<div class="py-4">
<h3 class="text-2xl font-semibold"><a href="{{ url('ui_examples.single', {'name': example.id}) }}">{{ example.label }}</a></h3>
{% if example.description %}
<p>{{ example.description }}</p>
{% endif %}
{% if example.render_links %}
<ul>
{% for link in example.render_links %}
<li>{{ link }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endfor %}
</div>
{% endfor %}
{% endif %}
Comments
Comment #3
g4mbini