From 942827f3797b6352eb34b1f111fa04c274079d22 Mon Sep 17 00:00:00 2001 From: Antoine Waehren Date: Thu, 2 Dec 2021 23:31:38 +0100 Subject: [PATCH 1/5] =?UTF-8?q?M=C3=A0j=20styles.=20Finalisation=20page=20?= =?UTF-8?q?accueil.=20M=C3=A0j=20page=20sauveteurs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/style.css | 46 ++++++++++++++++++++++++++++++++++++---- templates/index.html | 8 ++++--- templates/sauveteur.html | 18 +++++++++++++--- 3 files changed, 62 insertions(+), 10 deletions(-) diff --git a/static/style.css b/static/style.css index b466fa2..4314d64 100644 --- a/static/style.css +++ b/static/style.css @@ -1,17 +1,55 @@ body { + font-family: arial; } -h1 { -} - -p { +h1, p { + padding: 20px; } table, tr, td { border: 1px solid black; border-collapse: collapse; + padding: 10px; } .table_key { font-weight: bold; } + +.article { + display: flex; +} + +#banner { + background-color: #dfcba8; + margin-left: calc(-50vw + 50%); + margin-right: calc(-50vw + 50%); + margin-top:calc(-50vw + 50%); + display: flex; + align-items: center; + padding-top: 5px; + padding-bottom: 5px; +} + +#banner_index { + background-color: #dfcba8; + margin-left: calc(-50vw + 50%); + margin-right: calc(-50vw + 50%); + margin-top:calc(-50vw + 50%); + padding-top: 5px; + padding-bottom: 5px; +} + +#logo_title { + font-weight: bold; + font-size: 30px; +} + +.searchbar { + float: right; + padding-right: 20px; +} + +.right-align { + margin-left: auto; +} diff --git a/templates/index.html b/templates/index.html index f88b0e2..0c244e7 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,12 +5,14 @@ +
+
diff --git a/templates/sauveteur.html b/templates/sauveteur.html index f10c532..c869a42 100644 --- a/templates/sauveteur.html +++ b/templates/sauveteur.html @@ -10,12 +10,23 @@ description - {{nom}} {{prenom}} - Sauveuteur du dunkerquois + {{nom}} {{prenom}} - Sauveuteurs du dunkerquois - + +
+ + + +

{{nom}} {{prenom}}

+
+

{{description}}Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.

+

@@ -33,6 +44,7 @@ description
Nom{{nom}}Gratifications{{gratifications}}
-

{{description}}

+

+
From 9845179f64325af1dc7c6a1011c1a773f470fae0 Mon Sep 17 00:00:00 2001 From: Antoine Waehren Date: Fri, 3 Dec 2021 01:03:18 +0100 Subject: [PATCH 2/5] Finalisation temp sauveteur. --- static/style.css | 6 +++--- templates/sauveteur.html | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/static/style.css b/static/style.css index 4314d64..84f2a2e 100644 --- a/static/style.css +++ b/static/style.css @@ -16,7 +16,7 @@ table, tr, td { font-weight: bold; } -.article { +.flexbox { display: flex; } @@ -24,7 +24,7 @@ table, tr, td { background-color: #dfcba8; margin-left: calc(-50vw + 50%); margin-right: calc(-50vw + 50%); - margin-top:calc(-50vw + 50%); + margin-top: calc(-50vw + 50%); display: flex; align-items: center; padding-top: 5px; @@ -35,7 +35,7 @@ table, tr, td { background-color: #dfcba8; margin-left: calc(-50vw + 50%); margin-right: calc(-50vw + 50%); - margin-top:calc(-50vw + 50%); + margin-top: calc(-50vw + 50%); padding-top: 5px; padding-bottom: 5px; } diff --git a/templates/sauveteur.html b/templates/sauveteur.html index c869a42..64b6e2e 100644 --- a/templates/sauveteur.html +++ b/templates/sauveteur.html @@ -19,13 +19,14 @@ description Sauveuteurs du dunkerquois
+ Proposer une modification

{{nom}} {{prenom}}

-
-

{{description}}Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.

+
+

{{description}}

From d51b76974833cc745c56cccb4800326eb0a9b312 Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Fri, 3 Dec 2021 01:08:46 +0100 Subject: [PATCH 3/5] Fix de la page sauveteur --- app.py | 4 ++++ definitions.py | 24 ++++++++++++++++++------ pages.py | 15 +++++++++++++++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 7c4ec81..025d143 100644 --- a/app.py +++ b/app.py @@ -10,6 +10,10 @@ app = Flask(__name__) def main(): return pages.main() +@app.route('/sauveteurs/') +def sauveteur(idsauveteur): + return pages.sauveteur(idsauveteur) + @app.errorhandler(404) def error(e): return pages.error() diff --git a/definitions.py b/definitions.py index 893429a..7aa5cf1 100644 --- a/definitions.py +++ b/definitions.py @@ -1,8 +1,20 @@ ### Fonctions communes +import sqlite3 -def read(path): - # Retourne le contenu texte d'un fichier - f = open(path,'r') - result = f.read() - f.close() - return result +def ex_sql(db_name,request,replace=""): + conn = sqlite3.connect(db_name) + conn.row_factory=sqlite3.Row # La fonction retourne des dicos et pas des listes + cur = conn.cursor() + if not replace=="": + cur.execute(request,replace) + else: + cur.execute(request) + conn.commit() + a = None + if "SELECT" in request.upper(): + a = cur.fetchall() + for i in range(len(a)): + a[i] = dict(a[i]) # Convertir les dicos sqlite3 en dico classiques python + cur.close() + conn.close() + return a diff --git a/pages.py b/pages.py index af35d37..8135828 100644 --- a/pages.py +++ b/pages.py @@ -1,6 +1,8 @@ from flask import render_template import definitions as lib +dbname = "site.db" + # Fonctions qui seront associées à des URLs def main(): @@ -8,3 +10,16 @@ def main(): def error(): return render_template("error.html") + +def sauveteur(idsauveteur): + dico = {} + dico["nom"] = "John" + dico["prenom"] = "Doe" + dico["nb_sauvetages"] = 666 + dico["nb_sauves"] = 666 + dico["gratifications"] = 1 + dico["description"] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at odio cursus, rutrum odio non, dignissim risus. Pellentesque non varius ante. Vivamus scelerisque pulvinar mauris, nec imperdiet ante mattis et." + result = lib.ex_sql(dbname,"SELECT * FROM sauveteur WHERE personal_id=?",(idsauveteur,))[0] + dico["nom"] = result["nom"] + dico["prenom"] = result["prenom"] + return render_template("sauveteur.html",**dico) From 77232cfff8308e909e92080c67984c85359a6c83 Mon Sep 17 00:00:00 2001 From: Antoine Waehren Date: Fri, 3 Dec 2021 01:09:48 +0100 Subject: [PATCH 4/5] Ajout de variables sauveteur. --- templates/sauveteur.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/sauveteur.html b/templates/sauveteur.html index 64b6e2e..fab59a9 100644 --- a/templates/sauveteur.html +++ b/templates/sauveteur.html @@ -2,6 +2,8 @@