Work on blog

rewrite entire blog section
This commit is contained in:
2025-12-13 02:30:50 +01:00
parent 68d798845d
commit a5ba0b90bb
14 changed files with 354 additions and 72 deletions

View File

@@ -22,13 +22,20 @@
</li>
<li>
<a href="/myblog/personnalize/" {% if request.path == "/myblog/personnalize/" %} class="invert" {% endif %} ><span class="icons custom-blog"></span>
Configurer mon site web
Personnaliser mon blog
</a>
</li>
<li>
<a href="/private-blog/" {% if request.path == "/private-blog/" %} class="invert" {% endif %} ><span class="icons view-blog" aria-hidden="true"></span>
Voir le blog
<a href="/myblog/" {% if request.path == "/myblog/" %} class="invert" {% endif %} ><span class="icons view-blog" aria-hidden="true"></span>
Voir mon blog
</a>
</li>
<li>
<a href="/private-blog/" {% if request.path == "/private-blog/" %} class="invert" {% endif %} ><span class="icons view-blog" aria-hidden="true"></span>
Voir le blog général
</a>
</li>
</ul>

View File

@@ -12,7 +12,7 @@
<h2 class="titre"> {{ post_info.title }} </h2>
<h5 class="titre">Publié le : {{ post_info.creation_date }} </h5>
<h5 class="titre">Publié le : {{ post_info.creation_date }} par <a href="{{ url_for('blog.view') }}/{{ post_info.author }}"> {{ post_info.author }} </h5>
{% if post_info.last_updated %}
<h5 class="titre">Mis à jour le : {{ post_info.last_updated }} </h5>
{% endif %}

View File

@@ -0,0 +1,26 @@
<!doctype html>
<html>
<head>
<title> Article de {{ post_info.author }} </title>
<link rel="stylesheet" href="/static/{{ post_info.author}}/blog.css" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="articles">
<h2 class="titre"> {{ post_info.title }} </h2>
<h5 class="titre">Publié le : {{ post_info.creation_date }} </h5>
{% if post_info.last_updated %}
<h5 class="titre">Mis à jour le : {{ post_info.last_updated }} </h5>
{% endif %}
<h3 class="description titre"> {{ post_info.subtitle }} </h3>
<hr/>
{{ content|safe }}
</div>
</body>
</html>

35
templates/blog_rss.xml Normal file
View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
<title> Le blog de {{ blog_name }} </title>
<link> {{ base_url }}/blog/ </link>
{% if blog_description %}
<description> {{ blog_description }} </description>
{% endif %}
<language>fr</language>
<lastBuildDate> {{ last_build_date }} </lastBuildDate>
{% for post in posts %}
<item>
<title> {{ post.title }} </title>
<pubdate> {% if post.last_updated %} {{ post.last_updated }} {% else %} {{ post.time }} {% endif %} </pubdate>
<link> {{base_url}}/blog/{{ post.status }}/{{post.author}}/{{post.title}}</link>
<guid> {{base_url}}/blog/{{ post.status }}/{{post.author}}/{{post.title}}</guid>
<description>
{{ post.subtitle }}
</description>
<content:encoded>
{{ post.content | safe }}
</content:encoded>
</item>
{% endfor %}
</channel>
</rss>

View File

@@ -1,17 +1,18 @@
{% extends 'up_squelette.html' %}
{% block main %}
<p>Vous pouvez modifier votre article. </p>
<h2> {{ oldpost['title'] }}</h2><br />
<form action="" method="POST" id="postform" style="height: 15vw;">
<input type="text" name="subtitle" id="subtitle" placeholder="sous-titre" class="form-control" value="{{ oldpost['title'] }}"><br />
<input type="text" name="title" id="title" placeholder="titre" class="form-control" value="{{ oldpost['title'] }}"><br />
<input type="text" name="subtitle" id="subtitle" placeholder="sous-titre" class="form-control" value="{{ oldpost['subtitle'] }}"><br />
<input type="text" name="category" id="category" placeholder="Catégorie" class="form-control" value="{{ oldpost['category'] }}"><br />
<textarea id="editeurMarkdown" class="form-control" form="postform" name="content" id="content" placeholder="Contenu" style="height:20vw;">{{ oldpost['content'] }}</textarea><br />
<textarea id="editeurMarkdown" class="form-control" form="postform" name="content" id="content" placeholder="Contenu" style="height:20vw;">{{ oldpost['content'] }}</textarea>
<br />
<h3> Visibilité </h3>
<div class="center">
<p> Les articles brouillons ne sont visibles que par vous même</p>
<p> Les articles privés ne sont visibles que par les membres du serveur </p>
@@ -34,15 +35,23 @@
{% endif %}
</div>
<br />
<fieldset>
<label>
{% if blog_unified == "True" %}
<input id="blog-unified" name="blog-unified" type="checkbox" role="switch" checked />
{% else %}
<input id="blog-unified" name="blog-unified" type="checkbox" role="switch" />
{% endif %}
Publier cet article dans le blog général
</label>
</fieldset>
<button type="submit"> Mettre à jour </button>
</form>
<br />
{% endblock %}
{% block js %}
{% include '_js_editor.html' %}
{% endblock %}

View File

@@ -0,0 +1,41 @@
<!doctype html>
<html>
<head>
<title> Le Blog du serveur </title>
<link rel="stylesheet" href="/static/{{author}}/blog.css" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
{% if not(posts) %}
<h1 style="text-align: center;"> Désolé ce blog n'existe pas encore :/ </h1>
{% else %}
<div class="articles">
{% for post in posts %}
<h2 class="index"><a href="/blog/{author}}/{{post.title}}"> {{ post.title }}</a></h2>
<small>
<time datetime="{{ post.time }}">
Publié le {{ post.creation_date }}
</time>
<br/>
{% if post.last_updated %}
<time datetime="{{ post.last_updated }}">
Mis à jour le {{ post.last_updated }}
</time>
{% endif %}
</small>
<div class="slug">
<p> {{ post.subtitle }} </p>
<p class="readmore"> <a style="margin-right:2rem;" href="/blog/{{ post.status }}/{{post.author}}/{{post.title}}"> Lire la suite... </a></p>
</div>
{% endfor %}
</div>
{% endif %}
</body>
</html>

View File

@@ -14,13 +14,15 @@
{% else %}
<div class="articles">
<a href="/blog/rss.xml"> S'abonner au flux RSS </a>
{% for post in posts %}
<h2 class="index"><a href="/blog/{{user}}/{{post.title}}"> {{ post.title }}</a></h2>
<h2 class="index"><a href="/blog/{{post.author}}/{{post.title}}"> {{ post.title }}</a></h2>
<small>
<time datetime="{{ post.time }}">
Publié le {{ post.creation_date }}
Publié le {{ post.creation_date }} par <a href="{{ url_for('blog.view') }}/{{ post.author }}"> {{ post.author }}</a>
</time>
<br/>
{% if post.last_updated %}

View File

@@ -3,9 +3,10 @@
{% block main %}
<h2> Vos articles de blog </h2>
{% if nb_articles > 1 %}
<h2> Vos {{ nb_articles }} articles de blog </h2>
{% endif %}
<br/>
{% for article in list_posts %}
<article>
@@ -14,9 +15,25 @@
<br/>
<small> Créé le : {{ article.time }} </small> <br/>
<small> Modifié le : {{ article.last_updated }}</small>
<p> Status : {{ article.status }}</p>
<br/>
{% if article.last_updated == "private" %}
<small> Modifié le : {{ article.last_updated }}</small><br/>
{% endif %}
{% if article.status == "private" %}
<small> Status : privé </small>
<small> (L'article n'est pas publié dans le blog général) </small>
{% elif article.status == "private_unified" %}
<small> Status : privé </small>
<small> (L'article est publié dans le blog général) </small>
{% elif article.status == "public" %}
<small> Status : public </small>
<small> (L'article n'est pas publié dans le blog général) </small>
{% elif article.status == "public_unified" %}
<small> Status : public </small>
<small> (L'article est publié dans le blog général) </small>
{% endif %}
<br/>
<a href="{{ url_for('blog.edit', title=article.title) }}"><button type="button"> Editer </button></a>
<a href="{{ url_for('blog.delete', title=article.title) }}"><button type="button">Supprimer</button></a>

View File

@@ -32,6 +32,18 @@
<input type="radio" name="status" value="public">Public<br>
</div>
<br/>
<fieldset>
<label>
{% if blog_unified == "True" %}
<input id="blog-unified" name="blog-unified" type="checkbox" role="switch" checked />
{% else %}
<input id="blog-unified" name="blog-unified" type="checkbox" role="switch" />
{% endif %}
Publier cet article dans le blog général
</label>
</fieldset>
<button type="submit"> Créer l'article </button>
</form>

View File

@@ -3,6 +3,32 @@
{% block main %}
<h2> Ça va venir dans la prochaine version ! </h2>
<h2> Personnalisation du blog </h2>
<form method="POST" action="" enctype="multipart/form-data">
<br />
<label for="blog-theme">Theme</label>
<select id="blog-theme" name="blog-theme">
<option selected> Default </option>
<option>Blanc et noir</option>
<option>Noir et blanc </option>
<option>Chocolat</option>
<option>Orange et noir</option>
</select>
<div id="personnal-blog-theme" class="center">
<p> Vous pouvez faire le choix d'envoyer un fichier css pour personnaliser votre blog directement.
<label> Envoyer mon thème </label>
<input type="file" class="center" name="personnal-blog-theme" id="personnal-blog-theme"/>
<br />
</div>
<button class="btn btn-default btn-primary" type="submit"> Enregistrer mes modifications </button>
</form>
{% endblock %}