diff --git a/__snapshots__/layout/_template.spec.js.snap b/__snapshots__/layout/_template.spec.js.snap index 3fa2ab0f53..b5c50684f0 100644 --- a/__snapshots__/layout/_template.spec.js.snap +++ b/__snapshots__/layout/_template.spec.js.snap @@ -1393,13 +1393,19 @@ exports[`base page template matches the full configuration snapshot 1`] = ` + + + + +
@@ -1457,13 +1468,19 @@ exports[`base page template matches the full configuration snapshot 1`] = ` + + + + + @@ -1521,13 +1543,19 @@ exports[`base page template matches the full configuration snapshot 1`] = ` + + + + + @@ -1601,13 +1633,19 @@ exports[`base page template matches the full configuration snapshot 1`] = ` + + + + + diff --git a/src/components/list/_macro.njk b/src/components/list/_macro.njk index 2e87851fb4..517bc3b28b 100644 --- a/src/components/list/_macro.njk +++ b/src/components/list/_macro.njk @@ -20,10 +20,17 @@ {% else %} {% set listEl = 'ul' %} {% endif %} + + {% if listLength < 2 %} + {% set attributes = params.itemsList[0].attributes %} + {% else %} + {% set attributes = params.attributes %} + {% endif %} {% set openingTag = "<" + listEl %} {% set closingTag = "" + listEl + ">" %} + {{ openingTag | safe }}{% if params.id %}{{ ' ' }}id="{{ params.id }}"{% endif %} - class="ons-list{{ ' ons-list--p' if listEl == 'p' }}{{ ' ' + params.classes if params.classes else '' }}{% if params.variants %}{% if params.variants is not string %}{% for variant in variants %}{{ ' ' }}ons-list--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-list--{{ variants }}{% endif %}{% endif %}{{ ' ' + otherClasses if otherClasses else '' }}"{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}> + class="ons-list{{ ' ons-list--p' if listEl == 'p' }}{{ ' ' + params.classes if params.classes else '' }}{% if params.variants %}{% if params.variants is not string %}{% for variant in variants %}{{ ' ' }}ons-list--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-list--{{ variants }}{% endif %}{% endif %}{{ ' ' + otherClasses if otherClasses else '' }}"{% if params.attributes or params.itemsList[0].attributes %}{% for attribute, value in (attributes.items() if attributes is mapping and attributes.items else attributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}> {%- for item in params.itemsList -%} {% set sublistClasses = item.listClasses if item.listClasses %} {% @@ -74,6 +81,7 @@ }) }} {%- else -%} + {# Remove setting attributes on link in future update #} 1 or listEl == 'ul' %} + {# Remove if not item.url in future update #}