{% extends 'cjkcms/pages/web_page.html' %}
{% load wagtailcore_tags wagtailroutablepage_tags wagtailimages_tags static %}

{% block content_body %}
<div class="container">
    {% user_can_see course user 'SECURITY_COURSE' as can_see_course %}
    {% if can_see_course %}
        {% include 'lxp/snippets/course_summary_block.html' with use_description=True %}
    {% else %}
        {% include 'lxp/snippets/no_access_to_course.html' %}
    {% endif %}

    {% user_can_see course user 'SECURITY_LIST' as can_see_list %}
    {% if can_see_list %}
        {% include 'lxp/snippets/modules_and_activities_block.html' %}
    {% endif %}

    <p><a href="{{ page.get_parent.url }}" class="btn btn-dark btn-sm mt-2">Return to Course List</a></p>

    <!-- tags and learning paths (topics) begin -->

    {% if page.tags.all.count %}
        <div class="tags">
            <h3 class="small">Tags</h3>
            {% for tag in page.tags.all %}
                <a href="{% routablepageurl academy_page 'course_by_tag' tag.slug %}"
                   class="badge bg-light border link-dark mx-1">{{ tag }}</a>
            {% endfor %}
        </div>
    {% endif %}

    {% with topics=page.topics.all %}
        {% if topics %}
            <h3 class="small">Learning paths</h3>
            <div class="tags">
                {% for topic in topics %}
                       <a
                           class="badge bg-light border link-dark mx-1"
                           href="{% routablepageurl academy_page 'course_by_topic' topic.slug %}">
                           {{ topic.name }}
                       </a>
                {% endfor %}
            </div>
        {% endif %}
    {% endwith %}
    <!-- tags and learning paths (topics) end -->
</div>
{% endblock content_body %}

{% block custom_assets %}
<link rel="stylesheet" href="{% static 'lxp/css/lxp.css' %}" />
{% endblock custom_assets %}
