|
@@ -0,0 +1,66 @@
|
|
|
+{% load wagtailadmin_tags i18n %}
|
|
|
+{% comment %}
|
|
|
+ Variables this template accepts:
|
|
|
+
|
|
|
+ id_prefix - A prefix for all id attributes.
|
|
|
+ classes - List of CSS classes to use for the panel.
|
|
|
+ class_name - String of CSS classes to use for the panel.
|
|
|
+ id - Unique to the page.
|
|
|
+ heading - The text of the panel’s heading.
|
|
|
+ heading_size - The size of the heading.
|
|
|
+ icon - Displayed alongside the heading.
|
|
|
+ id_for_label - id of an associated field.
|
|
|
+ is_required - If the panel contains a required field.
|
|
|
+ children - Where to insert the panel’s contents.
|
|
|
+
|
|
|
+{% endcomment %}
|
|
|
+{% fragment as prefix %}{% if id_prefix %}{{ id_prefix }}-{% endif %}{{ id }}{% endfragment %}
|
|
|
+{% fragment as panel_id %}{{ prefix }}-section{% endfragment %}
|
|
|
+{% fragment as heading_id %}{{ prefix }}-heading{% endfragment %}
|
|
|
+{% fragment as content_id %}{{ prefix }}-content{% endfragment %}
|
|
|
+<section
|
|
|
+ class="w-panel {{ classes|join:' ' }}{{ class_name }}"
|
|
|
+ id="{{ panel_id }}"
|
|
|
+ aria-labelledby="{{ heading_id }}"
|
|
|
+ data-panel
|
|
|
+>
|
|
|
+ {# If a panel has no heading, we don’t want any of the associated UI. #}
|
|
|
+ {% if heading %}
|
|
|
+ <div class="w-panel__header">
|
|
|
+ <a
|
|
|
+ class="w-panel__anchor"
|
|
|
+ href="#{{ panel_id }}"
|
|
|
+ aria-label="{% trans 'Anchor section' %}"
|
|
|
+ aria-describedby="{{ heading_id }}"
|
|
|
+ >
|
|
|
+ {% icon name="link" class_name="w-panel__icon" %}
|
|
|
+ </a>
|
|
|
+ <button
|
|
|
+ class="w-panel__toggle"
|
|
|
+ type="button"
|
|
|
+ aria-label="{% trans 'Toggle section' %}"
|
|
|
+ aria-describedby="{{ heading_id }}"
|
|
|
+ data-panel-toggle
|
|
|
+ aria-controls="{{ content_id }}"
|
|
|
+ aria-expanded="true"
|
|
|
+ >
|
|
|
+ {# If there is a custom icon, we display it when the panel is expanded. #}
|
|
|
+ {% if icon %}
|
|
|
+ {% icon name=icon class_name="w-panel__icon w-panel__icon--custom" %}
|
|
|
+ {% endif %}
|
|
|
+ {% icon name="caret-down" class_name="w-panel__icon" %}
|
|
|
+ </button>
|
|
|
+ <h2 class="w-panel__heading {% if heading_size == "label" %}w-panel__heading--label{% endif %}" id="{{ heading_id }}">
|
|
|
+ {% if id_for_label %}
|
|
|
+ <label for="{{ id_for_label }}">{{ heading }}{% if is_required %}<span class="w-required-mark">*</span>{% endif %}</label>
|
|
|
+ {% else %}
|
|
|
+ {{ heading }}{% if is_required %}<span class="w-required-mark">*</span>{% endif %}
|
|
|
+ {% endif %}
|
|
|
+ </h2>
|
|
|
+ </div>
|
|
|
+ {% endif %}
|
|
|
+
|
|
|
+ <div id="{{ content_id }}" class="w-panel__content">
|
|
|
+ {{ children }}
|
|
|
+ </div>
|
|
|
+</section>
|