<commit_before>{% extends "base.html" %}

{% load static %}
{% load humanize %}
{% load has_perm_on %}

{% block title %}{{ course.slug|upper }} {{ course.name }}{% endblock %}

{% block header %}
    <header class="container-xl py-4 border-bottom bg-light">
        <h1 class="d-flex align-items-center gap-2">
            {% if course.is_archive %}
                <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
                    class="bi bi-archive-fill" viewBox="0 0 16 16">
                    <path
                        d="M12.643 15C13.979 15 15 13.845 15 12.5V5H1v7.5C1 13.845 2.021 15 3.357 15h9.286zM5.5 7h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zM.8 1a.8.8 0 0 0-.8.8V3a.8.8 0 0 0 .8.8h14.4A.8.8 0 0 0 16 3V1.8a.8.8 0 0 0-.8-.8H.8z"/>
                </svg>
            {% endif %}
            {{ course.slug|upper }} {{ course.name }}
        </h1>
        {% if course.is_archive %}
            <p>Ce cours ne fait plus partie du programme de l'ULB, il est gardé ici uniquement pour des raisons historiques.</p>
        {% endif %}
        {% if not course.is_archive %}
            <a class="btn btn-outline-success btn-sm d-inline-flex align-items-center gap-1"
                href="{% url 'document_put' course.slug %}">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                    class="bi bi-file-earmark-plus" viewBox="0 0 16 16">
                    <path
                        d="M8 6.5a.5.5 0 0 1 .5.5v1.5H10a.5.5 0 0 1 0 1H8.5V11a.5.5 0 0 1-1 0V9.5H6a.5.5 0 0 1 0-1h1.5V7a.5.5 0 0 1 .5-.5z"/>
                    <path
                        d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5L14 4.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5h-2z"/>
                </svg>
                <span>Partager un document</span>
            </a>
        {% endif %}
        {% if following %}
            <a href="{% url 'catalog:leave_course' course.slug %}"
                class="btn btn-outline-secondary btn-sm d-inline-flex align-items-center gap-1">


                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                    class="bi bi-star-fill text-warning hover-spin" viewBox="0 0 16 16">
                    <path
                        d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/>
                </svg>

                <span>Favori</span>
            </a>
        {% else %}
            <a href="{% url 'catalog:join_course' course.slug %}"
                class="btn btn-outline-secondary btn-sm d-inline-flex align-items-center gap-1">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                    class="bi bi-star hover-spin"
                    viewBox="0 0 16 16">
                    <path
                        d="M2.866 14.85c-.078.444.36.791.746.593l4.39-2.256 4.389 2.256c.386.198.824-.149.746-.592l-.83-4.73 3.522-3.356c.33-.314.16-.888-.282-.95l-4.898-.696L8.465.792a.513.513 0 0 0-.927 0L5.354 5.12l-4.898.696c-.441.062-.612.636-.283.95l3.523 3.356-.83 4.73zm4.905-2.767-3.686 1.894.694-3.957a.565.565 0 0 0-.163-.505L1.71 6.745l4.052-.576a.525.525 0 0 0 .393-.288L8 2.223l1.847 3.658a.525.525 0 0 0 .393.288l4.052.575-2.906 2.77a.565.565 0 0 0-.163.506l.694 3.957-3.686-1.894a.503.503 0 0 0-.461 0z"/>
                </svg>
                <span>Ajouter aux favoris</span>
            </a>
        {% endif %}
    </header>
{% endblock %}
{% block content %}
    <div data-controller="course-filter">
        <form class="d-flex mb-3 gap-2">
            <input
                class="flex-fill rounded px-2"
                style="border-style: solid"
                type="text" name="cours"
                placeholder="Chercher par titre de document..."
                data-course-filter-target="query"
                data-action="input->course-filter#filter"

            >
            <a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" role="button"
                aria-expanded="false" aria-controls="collapseExample">
                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-funnel"
                    viewBox="0 0 16 16">
                    <path
                        d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 7 8.5v5.306l2-.666V8.5a.5.5 0 0 1 .128-.334L13.5 3.308V2h-11z"/>
                </svg>
            </a>
        </form>
        <div class="collapse" id="collapseExample">
            <ul class="p-0" style="display: grid; grid: repeat(2, auto) / auto-flow auto; gap: 0.5em">
                {% for tag in tags %}
                    <li class="badge d-inline-flex gap-1 border"
                        style="accent-color:{{ tag.color }}; border-color:{{ tag.color }}; color: {{ tag.color }}">
                        <input type="checkbox"
                            id="tag-{{ tag.name }}"
                            data-tag-name="{{ tag.name }}"
                            data-action="change->course-filter#filter"
                            data-course-filter-target="tag"
                        />
                        <label for="tag-{{ tag.name }}">{{ tag.name }}</label>
                    </li>
                {% endfor %}
            </ul>
        </div>

        <ul class="p-0" style="list-style: none;">
            {% for document in documents %}
                <li
                    class="border-top p-2 d-flex align-items-center"
                    data-course-filter-target="filterable"
                    data-filter-key='{{ document.name }}'
                    data-tags="{{ tags|join:' ' }}"
                >

                    <a href="{% url 'document_show' document.pk %}"
                        class="d-flex align-items-center gap-2 text-reset text-decoration-none flex-grow-1">
                        <div class="rounded border bg-light p-1">
                            <img src="{% static "images/default_page.webp" %}"
                                width="60" height="50" style="object-fit: cover;">
                        </div>
                        <div>
                            <div class="hover-underline">
                                {{ document.name|capfirst }}
                                {% if document.is_certified %}
                                    <svg title="Ce document a été certifié" xmlns="http://www.w3.org/2000/svg"
                                        width="16" height="16" fill="currentColor"
                                        class="bi bi-patch-check-fill text-primary" viewBox="0 0 16 16">
                                        <path
                                            d="M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.89-.011a2.89 2.89 0 0 0-2.924 2.924l.01.89-.636.622a2.89 2.89 0 0 0 0 4.134l.637.622-.011.89a2.89 2.89 0 0 0 2.924 2.924l.89-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.637.89.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.89.636-.622a2.89 2.89 0 0 0 0-4.134l-.637-.622.011-.89a2.89 2.89 0 0 0-2.924-2.924l-.89.01-.622-.636zm.287 5.984-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7 8.793l2.646-2.647a.5.5 0 0 1 .708.708z"/>
                                    </svg><commit_msg>Fix the tag filtering on the course page (#250)<commit_after>{% extends "base.html" %}

{% load static %}
{% load humanize %}
{% load has_perm_on %}

{% block title %}{{ course.slug|upper }} {{ course.name }}{% endblock %}

{% block header %}
    <header class="container-xl py-4 border-bottom bg-light">
        <h1 class="d-flex align-items-center gap-2">
            {% if course.is_archive %}
                <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
                    class="bi bi-archive-fill" viewBox="0 0 16 16">
                    <path
                        d="M12.643 15C13.979 15 15 13.845 15 12.5V5H1v7.5C1 13.845 2.021 15 3.357 15h9.286zM5.5 7h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zM.8 1a.8.8 0 0 0-.8.8V3a.8.8 0 0 0 .8.8h14.4A.8.8 0 0 0 16 3V1.8a.8.8 0 0 0-.8-.8H.8z"/>
                </svg>
            {% endif %}
            {{ course.slug|upper }} {{ course.name }}
        </h1>
        {% if course.is_archive %}
            <p>Ce cours ne fait plus partie du programme de l'ULB, il est gardé ici uniquement pour des raisons historiques.</p>
        {% endif %}
        {% if not course.is_archive %}
            <a class="btn btn-outline-success btn-sm d-inline-flex align-items-center gap-1"
                href="{% url 'document_put' course.slug %}">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                    class="bi bi-file-earmark-plus" viewBox="0 0 16 16">
                    <path
                        d="M8 6.5a.5.5 0 0 1 .5.5v1.5H10a.5.5 0 0 1 0 1H8.5V11a.5.5 0 0 1-1 0V9.5H6a.5.5 0 0 1 0-1h1.5V7a.5.5 0 0 1 .5-.5z"/>
                    <path
                        d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5L14 4.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5h-2z"/>
                </svg>
                <span>Partager un document</span>
            </a>
        {% endif %}
        {% if following %}
            <a href="{% url 'catalog:leave_course' course.slug %}"
                class="btn btn-outline-secondary btn-sm d-inline-flex align-items-center gap-1">


                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                    class="bi bi-star-fill text-warning hover-spin" viewBox="0 0 16 16">
                    <path
                        d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/>
                </svg>

                <span>Favori</span>
            </a>
        {% else %}
            <a href="{% url 'catalog:join_course' course.slug %}"
                class="btn btn-outline-secondary btn-sm d-inline-flex align-items-center gap-1">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                    class="bi bi-star hover-spin"
                    viewBox="0 0 16 16">
                    <path
                        d="M2.866 14.85c-.078.444.36.791.746.593l4.39-2.256 4.389 2.256c.386.198.824-.149.746-.592l-.83-4.73 3.522-3.356c.33-.314.16-.888-.282-.95l-4.898-.696L8.465.792a.513.513 0 0 0-.927 0L5.354 5.12l-4.898.696c-.441.062-.612.636-.283.95l3.523 3.356-.83 4.73zm4.905-2.767-3.686 1.894.694-3.957a.565.565 0 0 0-.163-.505L1.71 6.745l4.052-.576a.525.525 0 0 0 .393-.288L8 2.223l1.847 3.658a.525.525 0 0 0 .393.288l4.052.575-2.906 2.77a.565.565 0 0 0-.163.506l.694 3.957-3.686-1.894a.503.503 0 0 0-.461 0z"/>
                </svg>
                <span>Ajouter aux favoris</span>
            </a>
        {% endif %}
    </header>
{% endblock %}
{% block content %}
    <div data-controller="course-filter">
        <form class="d-flex mb-3 gap-2">
            <input
                class="flex-fill rounded px-2"
                style="border-style: solid"
                type="text" name="cours"
                placeholder="Chercher par titre de document..."
                data-course-filter-target="query"
                data-action="input->course-filter#filter"

            >
            <a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" role="button"
                aria-expanded="false" aria-controls="collapseExample">
                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-funnel"
                    viewBox="0 0 16 16">
                    <path
                        d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 7 8.5v5.306l2-.666V8.5a.5.5 0 0 1 .128-.334L13.5 3.308V2h-11z"/>
                </svg>
            </a>
        </form>
        <div class="collapse" id="collapseExample">
            <ul class="p-0" style="display: grid; grid: repeat(2, auto) / auto-flow auto; gap: 0.5em">
                {% for tag in tags %}
                    <li class="badge d-inline-flex gap-1 border"
                        style="accent-color:{{ tag.color }}; border-color:{{ tag.color }}; color: {{ tag.color }}">
                        <input type="checkbox"
                            id="tag-{{ tag.name }}"
                            data-tag-name="{{ tag.name }}"
                            data-action="change->course-filter#filter"
                            data-course-filter-target="tag"
                        />
                        <label for="tag-{{ tag.name }}">{{ tag.name }}</label>
                    </li>
                {% endfor %}
            </ul>
        </div>

        <ul class="p-0" style="list-style: none;">
            {% for document in documents %}
                <li
                    class="border-top p-2 d-flex align-items-center"
                    data-course-filter-target="filterable"
                    data-filter-key='{{ document.name }}'
                    data-tags="{{ document.tags.all|join:' ' }}"
                >

                    <a href="{% url 'document_show' document.pk %}"
                        class="d-flex align-items-center gap-2 text-reset text-decoration-none flex-grow-1">
                        <div class="rounded border bg-light p-1">
                            <img src="{% static "images/default_page.webp" %}"
                                width="60" height="50" style="object-fit: cover;">
                        </div>
                        <div>
                            <div class="hover-underline">
                                {{ document.name|capfirst }}
                                {% if document.is_certified %}
                                    <svg title="Ce document a été certifié" xmlns="http://www.w3.org/2000/svg"
                                        width="16" height="16" fill="currentColor"
                                        class="bi bi-patch-check-fill text-primary" viewBox="0 0 16 16">
                                        <path
                                            d="M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.89-.011a2.89 2.89 0 0 0-2.924 2.924l.01.89-.636.622a2.89 2.89 0 0 0 0 4.134l.637.622-.011.89a2.89 2.89 0 0 0 2.924 2.924l.89-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.637.89.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.89.636-.622a2.89 2.89 0 0 0 0-4.134l-.637-.622.011-.89a2.89 2.89 0 0 0-2.924-2.924l-.89.01-.622-.636zm.287 5.984-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7 8.793l2.646-2.647a.5.5 0 0 1 .708.708z"/>
                                    </svg>
{'fraction_non_alphanumeric': 0.16164561062520247, 'fraction_numerical': 0.15931324910916747, 'mean_word_length': 1.370757180156658, 'pattern_counts': {'":': 0, '<': 123, '<?xml version=': 0, '>': 127, 'https://': 0, 'lorem ipsum': 0, 'www.': 12, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5200355', 'n_tokens_mistral': 7072, 'n_tokens_neox': 5370, 'n_words': 1145}