Add user theme in list articles

This commit is contained in:
kitoy 2025-12-22 01:57:28 +01:00
parent 89400555ed
commit 3266b02be7
3 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title> Le Blog du serveur </title> <title> Le Blog du serveur </title>
<link rel="stylesheet" href="/static/{{author}}/blog.css" type="text/css"> <link rel="stylesheet" href="/{{author}}/blog.css" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
</head> </head>
@ -17,7 +17,7 @@
<div class="articles"> <div class="articles">
{% for post in posts %} {% for post in posts %}
<h2 class="index"><a href="/blog/{author}}/{{post.title}}"> {{ post.title }}</a></h2> <h2 class="index"><a href="/blog/{{ post.status }}/{{author}}/{{post.title}}"> {{ post.title }}</a></h2>
<small> <small>
<time datetime="{{ post.time }}"> <time datetime="{{ post.time }}">
Publié le {{ post.creation_date }} Publié le {{ post.creation_date }}

View File

@ -2,7 +2,11 @@
<html> <html>
<head> <head>
<title> Le Blog du serveur </title> <title> Le Blog du serveur </title>
{% if author %}
<link rel="stylesheet" href="/{{author}}/blog.css" type="text/css">
{% else %}
<link rel="stylesheet" href="/static/blog.css" type="text/css"> <link rel="stylesheet" href="/static/blog.css" type="text/css">
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
</head> </head>
@ -19,7 +23,7 @@
<a href="/blog/rss.xml"> S'abonner au flux RSS </a> <a href="/blog/rss.xml"> S'abonner au flux RSS </a>
{% for post in posts %} {% for post in posts %}
<h2 class="index"><a href="/blog/{{post.author}}/{{post.title}}"> {{ post.title }}</a></h2> <h2 class="index"><a href="/blog/{{ post.status }}/{{post.author}}/{{post.title}}"> {{ post.title }}</a></h2>
<small> <small>
<time datetime="{{ post.time }}"> <time datetime="{{ post.time }}">
Publié le {{ post.creation_date }} par <a href="{{ url_for('blog.view') }}/{{ post.author }}"> {{ post.author }}</a> Publié le {{ post.creation_date }} par <a href="{{ url_for('blog.view') }}/{{ post.author }}"> {{ post.author }}</a>

View File

@ -139,7 +139,7 @@ def personnalize_blog():
if blog_theme != "Default": if blog_theme != "Default":
copy( "static/blog-"+blog_theme+".css", copy( "static/blog-"+blog_theme+".css",
DOSSIER_PERSO+ user +'blog.css' ) DOSSIER_PERSO+ user +'/blog.css' )
if f: # On vérifie qu'un fichier a bien été envoyé if f: # On vérifie qu'un fichier a bien été envoyé
nom = secure_filename(f.filename) nom = secure_filename(f.filename)
@ -167,7 +167,7 @@ def viewmyblog():
for post in list_posts: for post in list_posts:
posts=[dict(title=post[0], subtitle=post[1], creation_date=post[2], author=post[3], status=post[4])] + posts posts=[dict(title=post[0], subtitle=post[1], creation_date=post[2], author=post[3], status=post[4])] + posts
return render_template('index_blog.html', section='Blog', posts=posts) return render_template('index_blog.html', section='Blog', posts=posts, author=user)
@blog.route('/private-blog/', methods=['GET']) @blog.route('/private-blog/', methods=['GET'])
@ -223,7 +223,7 @@ def viewuser(author):
posts=[dict(title=post[0], subtitle=post[1], creation_date=post[2], last_updated=post[3], author=post[4], status=post[5])] + posts posts=[dict(title=post[0], subtitle=post[1], creation_date=post[2], last_updated=post[3], author=post[4], status=post[5])] + posts
return render_template('index_author_blog.html', section='Blog', posts=posts) return render_template('index_author_blog.html', section='Blog', posts=posts, author=author)
@blog.route('/blog/<author>/rss.xml', methods=['GET']) @blog.route('/blog/<author>/rss.xml', methods=['GET'])
def viewauthorrss(author): def viewauthorrss(author):