File size: 1,609 Bytes
e03dbe7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c43094
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8caf859
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{% extends "base.html" %}

{% block title %}{{ article.title }}{% endblock %}

{% block extra_head %}
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/trix.css">
{% endblock %}

{% block content %}
<nav aria-label="breadcrumb">
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="{{ url_for('home') }}">Matières</a></li>
        <li class="breadcrumb-item"><a href="{{ url_for('categories', subject_id=article.category.subject_id) }}">{{ article.category.subject.name }}</a></li>
        <li class="breadcrumb-item"><a href="{{ url_for('articles', category_id=article.category_id) }}">{{ article.category.name }}</a></li>
        <li class="breadcrumb-item active" aria-current="page">{{ article.title }}</li>
    </ol>
</nav>

<div class="article-content">
    <h1>{{ article.title }}</h1>
    {% set embed = article.youtube_url | youtube_embed %}
    {% if embed %}
    <div class="video-player" style="margin-bottom: 1rem;">
        <iframe width="100%" height="480" src="{{ embed }}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
    </div>
    {% endif %}
    <div class="trix-content">
        {{ (article.content | render_embeds) | safe }}
    </div>
</div>

<script>

document.addEventListener('DOMContentLoaded', function() {

    document.querySelectorAll('.trix-content img').forEach(img => {

        img.addEventListener('click', () => {

            window.open(img.src, '_blank');

        });

    });

});

</script>
{% endblock %}