{# The calendar: toolbar, source chips, then the month grid, the week/day columns or the list. #} {% macro item(c, compact=False) -%} {%- if not c.all_day %}{% endif -%} {%- if not compact and c.icon %}{{ icon(c.icon, 'h-3.5 w-3.5') }}{% endif -%} {%- if not c.all_day and c.time %}{{ c.short if compact else c.time }}{% endif -%} {{ c.title }} {%- endmacro %}

{{ cal.heading }}

{% if cal.chips %}
{% for c in cal.chips %}{{ __(c.label) }}{% endfor %}
{% endif %} {% if cal.failed %}
{{ __("Couldn't load:") }} {{ cal.failed|join(', ') }}. {{ __('The rest of the calendar is fine.') }}
{% endif %}
{% if cal.view == 'month' %}
{% for name in cal.weekdays %}
{{ name }}
{% endfor %} {% for week in cal.weeks %}{% for d in week %}
{{ d.num }} {% if d.new_url %}{{ icon('plus', 'h-4 w-4') }}{% endif %}
{% for c in d.shown %}{{ item(c, compact=True) }}{% endfor %} {% if d.more %}{{ __('+:n more', n=d.more) }}{% endif %}
{% endfor %}{% endfor %}
{% elif cal.view in ('week', 'day') %}
{% for d in cal.columns %}
{{ d.label.split(' ')[0] }} {{ d.num }} {% if d.new_url %}{{ icon('plus', 'h-4 w-4') }}{% endif %}
{% for c in d.rows %}{{ item(c) }}{% else %}
{{ __('Free') }}
{% endfor %}
{% endfor %}
{% else %} {% for d in cal.agenda %} {% else %}
{{ __('Nothing planned from :from to :to.', from=cal.first.strftime('%d %b'), to=cal.last.strftime('%d %b %Y')) }}{% if cal.new_url %} {{ __('Add an event') }}{% endif %}
{% endfor %} {% endif %}