Skip to content

expandable inserts <ul> tags when list is small #2020

Open
@GuillermoFidalgo

Description

@GuillermoFidalgo

I wanted to reuse the code

{% include get_all_events.html %}
{% assign sorted_events = all_events | sort: 'startdate' | reverse %}
{% assign training_events = "" | split: "," %}
{% for event in sorted_events %}
{% if event.labels %}
{% if event.labels contains "outreach" %}
{% assign training_events = training_events | push: event %}
{% endif %}
{% endif %}
{% endfor %}

{% expandable training_events 7 %}
{% include print_event.html students=1 event=expandable %}
{% endexpandable %}

on the newly renamed "outreach" page proposed in #2019 but I noticed when testing that if the interger argument for this line {% expandable training_events 7 %} is greater than the number of elements available (i.e we have only 2 events in the array training_events but I ask for 7 before the "Show More" box appears) then it renders
some unordered lists tags on the page.

This is not a big deal as eventually the array will contain more events, or I could simply make the number smaller for now. But it would nice for those tags to not render when we have few events to list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions