From d670d26bd5daa0f1aaa043b09883a1a26db3fe3d Mon Sep 17 00:00:00 2001 From: TheCoreDev Date: Sat, 9 Dec 2023 14:52:36 +0100 Subject: [PATCH] =?UTF-8?q?Rajout=20de=20la=20colonne=20Emball=C3=A9=20et?= =?UTF-8?q?=20modifs=20de=20style?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- .env.dev | 5 ----- public/styles.css | 48 ++++++++++++++++++++++++++++++++++++----------- views/index.hbs | 31 +++++++++++++----------------- wishlist.js | 14 +++++++++++++- 5 files changed, 64 insertions(+), 36 deletions(-) delete mode 100644 .env.dev diff --git a/.env b/.env index 9ab3b4a..b166b4a 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ DATABASE = wishlist -DATABASE_HOST = db.thecoredev.fr +DATABASE_HOST = nas.thecoredev.fr DATABASE_PORT = 3306 DATABASE_USER = wishlist DATABASE_PASSWORD = 7/yvv9JA[RomOkLe \ No newline at end of file diff --git a/.env.dev b/.env.dev deleted file mode 100644 index 9ab3b4a..0000000 --- a/.env.dev +++ /dev/null @@ -1,5 +0,0 @@ -DATABASE = wishlist -DATABASE_HOST = db.thecoredev.fr -DATABASE_PORT = 3306 -DATABASE_USER = wishlist -DATABASE_PASSWORD = 7/yvv9JA[RomOkLe \ No newline at end of file diff --git a/public/styles.css b/public/styles.css index 8814134..30471a1 100644 --- a/public/styles.css +++ b/public/styles.css @@ -4,27 +4,53 @@ text-align: left; } -/* -.tableau li:nth-child(2), -.tableau li:nth-child(3), -.tableau li:nth-child(4), -.tableau li:nth-child(5) { - width: 100px; +.tableau li { + width: 80px; +} +.tableau li:nth-child(2) { + width: 200px; +} +.tableau li:nth-child(3) { + width: 20px; } -*/ - .tableau li { flex: auto; list-style-type: none; - width: min-content; - padding: 8px; + padding: 0px 4px; align-self: center; + text-align: left; +} +figure { + margin: 4px 0px !important; +} + + +.tableau ul:nth-child(even) { + background-color: #f47f7f; +} +.tableau ul:nth-child(odd) { + background-color: white; +} + +.tableau figcaption { + font-weight: bold; +} +.tableau ul:nth-child(even) figcaption{ + color: white; +} +.tableau ul:nth-child(odd) figcaption { + color: #f47f7f; } .tableau ul:nth-child(even) { - background-color: aliceblue; + color: white; } +.tableau ul:nth-child(odd) { + color: #f47f7f; +} + + .tableau ul:first-child li { font-weight: bold; } diff --git a/views/index.hbs b/views/index.hbs index 47d65a5..a548979 100644 --- a/views/index.hbs +++ b/views/index.hbs @@ -20,14 +20,14 @@
-
  • {{#if this.pourNoel}}Noël{{else}}Anniversaire{{/if}}
  • +
  • + {{#if this.emballe}} + + {{else}} + + {{/if}} +
  • {{/each}} diff --git a/wishlist.js b/wishlist.js index dd40799..452e7a6 100644 --- a/wishlist.js +++ b/wishlist.js @@ -34,9 +34,21 @@ app.use(bodyParser.urlencoded({extended: false})); app.use(express.json()) +const isEqual = function(a, b, opts) { + if (a == b) { + return opts.fn(this) + } else { + return opts.inverse(this) + } + } + +var hbs = require('hbs'); +hbs.registerHelper('equals', isEqual); + + app.get("/", (req, res) => { - db.query('SELECT c.id as "id", c.libelle as "libelle", c.prix, c.photo as "photo", c.lien, p.prenom as "acheteur", c.achete as "achete", c.paye as "paye", p2.prenom as "responsableAchat", c.pour_noel as "pourNoel" FROM cadeau c LEFT OUTER JOIN participations pc on pc.cadeau = c.id LEFT OUTER JOIN participant p on p.id = pc.offrant LEFT OUTER JOIN participant p2 on p2.id = pc.responsable_achat ORDER BY c.prix', async (error, resultCadeaux) => { + db.query('SELECT c.id as "id", c.libelle as "libelle", c.prix, c.photo as "photo", c.lien, p.prenom as "acheteur", c.achete as "achete", c.paye as "paye", p2.prenom as "responsableAchat", c.pour_noel as "pourNoel", c.emballe as "emballe" FROM cadeau c LEFT OUTER JOIN participations pc on pc.cadeau = c.id LEFT OUTER JOIN participant p on p.id = pc.offrant LEFT OUTER JOIN participant p2 on p2.id = pc.responsable_achat ORDER BY c.prix', async (error, resultCadeaux) => { let message; if(error){