diff --git a/.gitignore b/.gitignore index 35bfada..2d0bb53 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ users/ sys *~ *#* -.* \ No newline at end of file +.* +base.db.new diff --git a/static/pywallter.css b/static/pywallter.css index c23cc46..6917a55 100644 --- a/static/pywallter.css +++ b/static/pywallter.css @@ -54,6 +54,36 @@ main > nav color: var(--pico-color-green-500); } +@media (min-width: 1200px) +{ + .list-articles{ + padding-top: 2vw; + display: inline-flex; + gap:30px; + flex-wrap: wrap; + } + + + article { + text-align: center; + width: 30vw; + height: 35vw; + } + + article > header { + height: 15vw; + } + + article > .subtitle { + height: 10vw; + + article footer{ + display: block; + height: 5vw; + } + +} + @media only screen and (max-width: 600px) { body { diff --git a/templates/accueil.html b/templates/accueil.html index c2cce8b..833ec06 100644 --- a/templates/accueil.html +++ b/templates/accueil.html @@ -41,8 +41,27 @@

Mouarf j'ai perdu mon mot de passe

- - +

Les derniers articles de blog sur le serveur

+
+ + {% for article in list_posts %} +
+
+

{{ article.title }}

+
par /{{ article.author }}
+
+ Créé le : {{ article.creation_date }}
+ {% if article.last_updated %} + Modifié le : {{ article.last_updated }}
+ {% endif %} +
+
+

{{ article.subtitle }}

+
+ + +
+ {% endfor %} {% endblock %} diff --git a/views/loginlogout.py b/views/loginlogout.py index d41eb74..574a323 100644 --- a/views/loginlogout.py +++ b/views/loginlogout.py @@ -88,10 +88,22 @@ def login(): else: flash(u"L'utilisateur n'existe pas", 'error') else: + conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée + cursor = conn.cursor() # Création de l'objet "curseur" + cursor.execute("""SELECT title, subtitle, creation_date, last_updated, author FROM Blog_posts WHERE status='public_unified'""" ) + list_posts=cursor.fetchall() + posts=list() + id=0 + conn.close() + if list_posts != None: + for post in list_posts: + posts=[dict(title=post[0], subtitle=post[1], creation_date=post[2], last_updated=post[3], author=post[4])] + posts + resp = render_template('accueil.html', server_title=SERVER_TITLE, server_desc=SERVER_DESC, mail_server=MAIL_SERVER, + list_posts=posts, signin_enable=app.config['SIGNIN_ENABLE']) return resp