#issue/17 #18

Merged
dbroqua merged 1 commit from issue/17 into master 2022-02-22 14:50:08 +01:00
11 changed files with 88 additions and 12 deletions
Showing only changes of commit 2dd631ad91 - Show all commits

View file

@ -20,7 +20,11 @@ services:
- mymusiclibrary-db - mymusiclibrary-db
environment: environment:
NODE_ENV: ${NODE_ENV} NODE_ENV: ${NODE_ENV}
PORT: ${PORT}
MONGODB_URI: ${MONGODB_URI}
SECRET: ${SECRET}
DISCOGS_TOKEN: ${DISCOGS_TOKEN} DISCOGS_TOKEN: ${DISCOGS_TOKEN}
FORMSPREE_ID: ${FORMSPREE_ID}
networks: networks:
- mymusiclibrary - mymusiclibrary
mymusiclibrary-db: mymusiclibrary-db:

View file

@ -20,7 +20,11 @@ services:
- mymusiclibrary-db - mymusiclibrary-db
environment: environment:
NODE_ENV: ${NODE_ENV} NODE_ENV: ${NODE_ENV}
PORT: ${PORT}
MONGODB_URI: ${MONGODB_URI}
SECRET: ${SECRET}
DISCOGS_TOKEN: ${DISCOGS_TOKEN} DISCOGS_TOKEN: ${DISCOGS_TOKEN}
FORMSPREE_ID: ${FORMSPREE_ID}
networks: networks:
- mymusiclibrary - mymusiclibrary
mymusiclibrary-db: mymusiclibrary-db:

10
sass/error.scss Normal file
View file

@ -0,0 +1,10 @@
.error {
min-height: calc(100vh - 3.25rem - 100px);
padding-top: 4rem;
pre {
padding: 0.75rem;
border: 1px dotted #cecccc;
background: #f9f9f9;
}
}

View file

@ -24,6 +24,7 @@
font-weight: 800; font-weight: 800;
} }
input, input,
textarea,
select { select {
border-radius: 0.375rem; border-radius: 0.375rem;
box-shadow: inset 0 .0625em .125em rgba(10,10,10,.05); box-shadow: inset 0 .0625em .125em rgba(10,10,10,.05);

View file

@ -36,7 +36,9 @@
@import './pagination'; @import './pagination';
@import './icons'; @import './icons';
@import './error';
@import './home'; @import './home';
@import './connexion'; @import './connexion';
@import './ajouter-un-album'; @import './ajouter-un-album';
@import './ma-collection'; @import './ma-collection';
@import './nous-contacter';

15
sass/nous-contacter.scss Normal file
View file

@ -0,0 +1,15 @@
.nous-contacter {
width: calc(100% - 2rem);
margin: 2rem auto;
@include respond-to("small-up") {
width: 55%;
}
@include respond-to("medium-up") {
width: 35%;
}
button {
margin-top: 2rem;
}
}

View file

@ -1,3 +1,5 @@
console.log("formspreeId: process.env.FORMSPREE_ID:", process.env.FORMSPREE_ID);
module.exports = { module.exports = {
nodeEnv: process.env.NODE_ENV || "development", nodeEnv: process.env.NODE_ENV || "development",
port: parseInt(process.env.PORT || "3001", 10), port: parseInt(process.env.PORT || "3001", 10),
@ -5,4 +7,5 @@ module.exports = {
process.env.MONGODB_URI || "mongodb://mymusiclibrary-db/mymusiclibrary", process.env.MONGODB_URI || "mongodb://mymusiclibrary-db/mymusiclibrary",
secret: process.env.SECRET || "waemaeMe5ahc6ce1chaeKohKa6Io8Eik", secret: process.env.SECRET || "waemaeMe5ahc6ce1chaeKohKa6Io8Eik",
discogsToken: process.env.DISCOGS_TOKEN, discogsToken: process.env.DISCOGS_TOKEN,
formspreeId: process.env.FORMSPREE_ID,
}; };

View file

@ -107,6 +107,18 @@ router
} }
}); });
router.route("/nous-contacter").get(async (req, res, next) => {
try {
const page = new Albums(req, "nous-contacter");
await page.loadMyCollection();
render(res, page);
} catch (err) {
next(err);
}
});
router.route("/se-deconnecter").get((req, res) => { router.route("/se-deconnecter").get((req, res) => {
req.logout(); req.logout();
req.session.destroy(() => { req.session.destroy(() => {

View file

@ -1,11 +1,11 @@
<div class="container"> <main class="layout-maxed error">
<section class="px-md-5 mx-md-5 dark-grey-text mb-4"> <h1><%= page.title %></h1>
<h1><%= page.title %></h1> <% if ( errorCode && errorCode === 404 ) { %>
<% if ( errorCode && errorCode === 404 ) { %> <p class="text-center">
<img src="/img/404.svg" alt="Erreur 404" style="max-height: 400px;" /> <img src="/img/404.svg" alt="Erreur 404" style="max-height: 400px;" />
<% } %> </p>
<pre> <% } %>
<%= page.error %> <div>
</pre> <pre><%= page.error %></pre>
</section> </div>
</div> </main>

View file

@ -86,6 +86,9 @@
<% } %> <% } %>
<div class="navbar-end"> <div class="navbar-end">
<a class="navbar-item" href="/nous-contacter">
Nous contacter
</a>
<% if ( user ) { %> <% if ( user ) { %>
<div class="navbar-item has-dropdown"> <div class="navbar-item has-dropdown">
<a class="navbar-link"> <a class="navbar-link">

View file

@ -0,0 +1,22 @@
<section class="nous-contacter">
<h1>Nous contacter</h1>
<form action="https://formspree.io/f/<%= config.formspreeId %>" method="POST">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-16">
<div class="field">
<label for="email">Addresse e-mail*</label>
<input type="email" name="email" id="email" required />
</div>
<div class="field">
<label for="name">Prénom, nom</label>
<input type="text" name="name" id="name" />
</div>
</div>
<div class="field">
<label for="message">Message*</label>
<textarea name="message" id="message" rows="6" required ></textarea>
</div>
<button type="submit" class="button is-primary">Envoyer</button>
</form>
</section>