Upload 6 files
Browse files- templates/base.html +33 -0
- templates/index.html +17 -0
- templates/moderate.html +22 -0
- templates/new_thread.html +12 -0
- templates/search.html +29 -0
- templates/thread.html +63 -0
templates/base.html
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!doctype html>
|
2 |
+
<html lang="fr">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<title>{% block title %}Forum Anonyme{% endblock %}</title>
|
6 |
+
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<div class="container">
|
10 |
+
<header>
|
11 |
+
<h1><a href="{{ url_for('index') }}">Forum Anonyme</a></h1>
|
12 |
+
<nav>
|
13 |
+
<a href="{{ url_for('new_thread') }}">Nouveau fil</a> |
|
14 |
+
<a href="{{ url_for('moderate') }}">Modération</a>
|
15 |
+
</nav>
|
16 |
+
<form action="{{ url_for('search') }}" method="GET">
|
17 |
+
<input type="text" name="q" placeholder="Recherche..." required>
|
18 |
+
<button type="submit">Chercher</button>
|
19 |
+
</form>
|
20 |
+
</header>
|
21 |
+
{% with messages = get_flashed_messages(with_categories=true) %}
|
22 |
+
{% if messages %}
|
23 |
+
<ul class="flashes">
|
24 |
+
{% for category, message in messages %}
|
25 |
+
<li class="flash {{ category }}">{{ message }}</li>
|
26 |
+
{% endfor %}
|
27 |
+
</ul>
|
28 |
+
{% endif %}
|
29 |
+
{% endwith %}
|
30 |
+
{% block content %}{% endblock %}
|
31 |
+
</div>
|
32 |
+
</body>
|
33 |
+
</html>
|
templates/index.html
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
{% block title %}Accueil - Forum Anonyme{% endblock %}
|
3 |
+
{% block content %}
|
4 |
+
<h2>Fils de discussion</h2>
|
5 |
+
{% if threads %}
|
6 |
+
<ul class="thread-list">
|
7 |
+
{% for thread in threads %}
|
8 |
+
<li>
|
9 |
+
<a href="{{ url_for('thread', thread_id=thread.id) }}">{{ thread.title }}</a>
|
10 |
+
<small>Créé le {{ thread.timestamp.strftime('%d/%m/%Y %H:%M:%S') }}</small>
|
11 |
+
</li>
|
12 |
+
{% endfor %}
|
13 |
+
</ul>
|
14 |
+
{% else %}
|
15 |
+
<p>Aucun fil de discussion pour le moment.</p>
|
16 |
+
{% endif %}
|
17 |
+
{% endblock %}
|
templates/moderate.html
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
{% block title %}Modération{% endblock %}
|
3 |
+
{% block content %}
|
4 |
+
<h2>Modération</h2>
|
5 |
+
{% if messages %}
|
6 |
+
<ul class="message-list">
|
7 |
+
{% for msg in messages %}
|
8 |
+
<li>
|
9 |
+
<div class="message">
|
10 |
+
<p>{{ msg.content|safe }}</p>
|
11 |
+
<small>Posté le {{ msg.timestamp.strftime('%d/%m/%Y %H:%M:%S') }} - Signalements: {{ msg.reports }}</small>
|
12 |
+
<form action="{{ url_for('remove_message', message_id=msg.id) }}" method="POST">
|
13 |
+
<button type="submit">Retirer le message</button>
|
14 |
+
</form>
|
15 |
+
</div>
|
16 |
+
</li>
|
17 |
+
{% endfor %}
|
18 |
+
</ul>
|
19 |
+
{% else %}
|
20 |
+
<p>Aucun message signalé.</p>
|
21 |
+
{% endif %}
|
22 |
+
{% endblock %}
|
templates/new_thread.html
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
{% block title %}Nouveau Fil de Discussion{% endblock %}
|
3 |
+
{% block content %}
|
4 |
+
<h2>Créer un nouveau fil de discussion</h2>
|
5 |
+
<form method="POST" action="{{ url_for('new_thread') }}">
|
6 |
+
<label for="title">Titre :</label><br>
|
7 |
+
<input type="text" name="title" id="title" required><br><br>
|
8 |
+
<label for="content">Message initial :</label><br>
|
9 |
+
<textarea name="content" id="content" rows="5" required></textarea><br>
|
10 |
+
<button type="submit">Créer</button>
|
11 |
+
</form>
|
12 |
+
{% endblock %}
|
templates/search.html
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
{% block title %}Résultats de recherche{% endblock %}
|
3 |
+
{% block content %}
|
4 |
+
<h2>Résultats de recherche pour "{{ query }}"</h2>
|
5 |
+
<h3>Fils de discussion</h3>
|
6 |
+
{% if threads %}
|
7 |
+
<ul class="thread-list">
|
8 |
+
{% for thread in threads %}
|
9 |
+
<li><a href="{{ url_for('thread', thread_id=thread.id) }}">{{ thread.title }}</a></li>
|
10 |
+
{% endfor %}
|
11 |
+
</ul>
|
12 |
+
{% else %}
|
13 |
+
<p>Aucun fil de discussion trouvé.</p>
|
14 |
+
{% endif %}
|
15 |
+
<h3>Messages</h3>
|
16 |
+
{% if messages %}
|
17 |
+
<ul class="message-list">
|
18 |
+
{% for msg in messages %}
|
19 |
+
<li>
|
20 |
+
<a href="{{ url_for('thread', thread_id=msg.thread_id) }}#msg{{ msg.id }}">
|
21 |
+
{{ msg.content[:100]|safe }}...
|
22 |
+
</a>
|
23 |
+
</li>
|
24 |
+
{% endfor %}
|
25 |
+
</ul>
|
26 |
+
{% else %}
|
27 |
+
<p>Aucun message trouvé.</p>
|
28 |
+
{% endif %}
|
29 |
+
{% endblock %}
|
templates/thread.html
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
{% block title %}{{ thread.title }}{% endblock %}
|
3 |
+
{% block content %}
|
4 |
+
<h2>{{ thread.title }}</h2>
|
5 |
+
<p>Créé le {{ thread.timestamp.strftime('%d/%m/%Y %H:%M:%S') }}</p>
|
6 |
+
<hr>
|
7 |
+
<h3>Messages</h3>
|
8 |
+
{% for msg in messages %}
|
9 |
+
<div class="message {% if msg.removed %}removed{% endif %}">
|
10 |
+
{% if not msg.removed %}
|
11 |
+
<p>{{ msg.content | safe }}</p>
|
12 |
+
<small>Posté le {{ msg.timestamp.strftime('%d/%m/%Y %H:%M:%S') }} - Votes: {{ msg.vote_count }}</small>
|
13 |
+
<div class="message-actions">
|
14 |
+
<form action="{{ url_for('vote', message_id=msg.id, action='up') }}" method="POST" style="display:inline;">
|
15 |
+
<button type="submit">Upvote</button>
|
16 |
+
</form>
|
17 |
+
<form action="{{ url_for('vote', message_id=msg.id, action='down') }}" method="POST" style="display:inline;">
|
18 |
+
<button type="submit">Downvote</button>
|
19 |
+
</form>
|
20 |
+
<form action="{{ url_for('report', message_id=msg.id) }}" method="POST" style="display:inline;">
|
21 |
+
<button type="submit">Signaler</button>
|
22 |
+
</form>
|
23 |
+
<button onclick="quoteMessage('{{ msg.id }}', '{{ msg.content|escapejs }}')">Citer</button>
|
24 |
+
</div>
|
25 |
+
{% else %}
|
26 |
+
<p><em>Message supprimé par modération.</em></p>
|
27 |
+
{% endif %}
|
28 |
+
</div>
|
29 |
+
<hr>
|
30 |
+
{% else %}
|
31 |
+
<p>Aucun message pour ce fil.</p>
|
32 |
+
{% endfor %}
|
33 |
+
<hr>
|
34 |
+
<h3>Répondre</h3>
|
35 |
+
<form method="POST" action="{{ url_for('thread', thread_id=thread.id) }}">
|
36 |
+
<textarea name="content" id="reply-content" rows="5" placeholder="Votre réponse ici..." required></textarea><br>
|
37 |
+
<button type="button" onclick="previewMessage()">Prévisualiser</button>
|
38 |
+
<button type="submit">Poster</button>
|
39 |
+
</form>
|
40 |
+
<div id="preview-area"></div>
|
41 |
+
<script>
|
42 |
+
// Prévisualisation via l'API /preview
|
43 |
+
function previewMessage() {
|
44 |
+
const content = document.getElementById('reply-content').value;
|
45 |
+
fetch('{{ url_for('preview') }}', {
|
46 |
+
method: 'POST',
|
47 |
+
headers: {
|
48 |
+
'Content-Type': 'application/x-www-form-urlencoded'
|
49 |
+
},
|
50 |
+
body: 'content=' + encodeURIComponent(content)
|
51 |
+
}).then(response => response.json())
|
52 |
+
.then(data => {
|
53 |
+
document.getElementById('preview-area').innerHTML = data.preview;
|
54 |
+
});
|
55 |
+
}
|
56 |
+
// Fonction de citation : ajoute le contenu cité dans la zone de réponse
|
57 |
+
function quoteMessage(messageId, content) {
|
58 |
+
const replyArea = document.getElementById('reply-content');
|
59 |
+
replyArea.value = "> " + content + "\n\n" + replyArea.value;
|
60 |
+
replyArea.focus();
|
61 |
+
}
|
62 |
+
</script>
|
63 |
+
{% endblock %}
|