{% extends "_base_course.html" %}
{% from "_material_macros.html" import material_list with context %}
{% import "_navigation_macros.html" as nav %}

{% block breadcrumbs %}
> <a href="{{ session.course.get_url() }}">{{ session.course.title }}</a>
> {{ session.title }}
{% endblock %}

{% block course_content %}
  <h1>
    {% if session.date %}
        Lekce: {{ session.title }} ({{ session.date }})
    {% else %}
        Lekce: {{ session.title }}
    {% endif %}
</h1>

{% if session.course.place and session.time %}
    <div class="details">{{ session.course.place }},
        {{ session.time.start | format_time }}–{{ session.time.end | format_time }}</div>
{% endif %}

{% if session.description %}{{ session.description }}{% endif %}

<h2>Materiály</h2>
{{ material_list(session.materials, filter_type='lesson') }}

{% if 'cheatsheet' in materials_by_type %}
    <h2>Taháky</h2>
    {{ material_list(session.materials, filter_type='cheatsheet') }}
{% endif %}

{% if 'homework' in materials_by_type %}
    <h2>Domácí projekty</h2>
    {{ material_list(session.materials, filter_type='homework') }}
{% endif %}


    {% if page.content %}
        {{ page.content }}
    {% endif %}


<hr class="lesson-end">

{% call nav.prevnext() %}
    {% if session and session.prev != None %}
        {#- XXX: This is wrong! Do s/session/session.prev/ #}
        {{ nav.prev(session.get_url(), session.title) }}
    {% endif %}
    {{ nav.up(session.course.get_url(), session.course.title) }}
    {{ nav.next(session.pages['back'].get_url(), 'Závěr lekce') }}
{% endcall %}
{% endblock %}
