#issue/17 (#18)
#issue-17 Co-authored-by: dbroqua <contact@darkou.fr> Reviewed-on: dbroqua/MyMusicLibrary#18 Co-authored-by: Damien Broqua <dbroqua@noreply.localhost> Co-committed-by: Damien Broqua <dbroqua@noreply.localhost>
This commit is contained in:
parent
7bcf9b121c
commit
60f96d75ef
11 changed files with 88 additions and 12 deletions
|
@ -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:
|
||||||
|
|
|
@ -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
10
sass/error.scss
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
|
|
@ -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
15
sass/nous-contacter.scss
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,
|
||||||
};
|
};
|
||||||
|
|
|
@ -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(() => {
|
||||||
|
|
|
@ -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>
|
<div>
|
||||||
<%= page.error %>
|
<pre><%= page.error %></pre>
|
||||||
</pre>
|
</div>
|
||||||
</section>
|
</main>
|
||||||
</div>
|
|
|
@ -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">
|
||||||
|
|
22
views/pages/nous-contacter.ejs
Normal file
22
views/pages/nous-contacter.ejs
Normal 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>
|
Loading…
Reference in a new issue