From 2962f2fe65114d672d33c0e05752a45137beae6a Mon Sep 17 00:00:00 2001
From: mhdaltaweel <mohamad.altaweel91@gmail.com>
Date: Fri, 1 Dec 2023 23:07:15 +0100
Subject: [PATCH] document page
---
app.js | 26 +++++++++++++++++++-----
public/css/spreadsheet-style.css | 23 +++++++++++++++++++++
public/css/style.css | 34 ++++++++++++++++++++++++++++++++
views/document.ejs | 33 +++++++++++++++++++++++++++++++
views/index.ejs | 27 ++++++++++++++++---------
views/login.ejs | 21 +++++++++++---------
views/signup.ejs | 1 +
7 files changed, 142 insertions(+), 23 deletions(-)
create mode 100644 public/css/spreadsheet-style.css
create mode 100644 public/css/style.css
create mode 100644 views/document.ejs
diff --git a/app.js b/app.js
index 747bc34..0046875 100644
--- a/app.js
+++ b/app.js
@@ -33,14 +33,13 @@ app.get("/", defaut).get("/accueil",defaut);
app.get("/db/:collection", collection).get("/db", dbAdmin);
app.get("/login", (req, res) => res.render("login")).post("/login", postLogin);
+
+
//route pour creation compte
app.get("/signup" , (req ,res)=>{
res.render("signup", { title: 'Inscription' });
+
});
-app.all("*", (req, res) => res.status(404).send("<h1>Il semblerait que cette page n'existe pas.</h1>"));
-
-
-
const saltRounds = 10;
app.post('/signup', async (req, res) => {
try {
@@ -53,15 +52,32 @@ app.post('/signup', async (req, res) => {
// Insère les données dans la base de données
await db.insert('users', { username, email, password:hashedPassword });
- res.send('Inscription réussie');
+ //res.send('Inscription réussie');
+ res.redirect("/login");
} catch (error) {
console.error(error);
res.status(500).send('Erreur lors de l\'inscription');
}
+
+});
+
+//route pour document
+app.get("/document" , (req ,res)=>{
+ res.render("document", { title: 'doc' });
});
+app.all("*", (req, res) => res.status(404).send("<h1>Il semblerait que cette page n'existe pas.</h1>"));
+
+
+
+
+
+
+
+
+
function defaut(req, res){
const ind = {method : req.method, url : req.url}
res.render("index",ind);
diff --git a/public/css/spreadsheet-style.css b/public/css/spreadsheet-style.css
new file mode 100644
index 0000000..15a43b7
--- /dev/null
+++ b/public/css/spreadsheet-style.css
@@ -0,0 +1,23 @@
+.spreadsheet-container {
+ display: flex;
+ justify-content: center;
+ margin-top: 20px;
+ }
+ table {
+ border-collapse: collapse;
+ }
+ td, th {
+ border: 1px solid #ddd;
+ text-align: center;
+ min-width: 60px;
+ height: 30px;
+ padding: 4px;
+ }
+ th {
+ background-color: #f4f4f4;
+ height: 40px;
+ }
+ tr:nth-child(odd) td {
+ background-color: #f9f9f9;
+ }
+
\ No newline at end of file
diff --git a/public/css/style.css b/public/css/style.css
new file mode 100644
index 0000000..4daea8c
--- /dev/null
+++ b/public/css/style.css
@@ -0,0 +1,34 @@
+body {
+ font-family: 'Arial', sans-serif;
+ margin: 0;
+ padding: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 100vh;
+ background-color: #f4f4f4;
+ }
+
+ .home-container {
+ text-align: center;
+ }
+
+ .button-container {
+ margin-top: 20px;
+ }
+
+ .button {
+ display: inline-block;
+ padding: 10px 20px;
+ margin: 0 10px;
+ text-decoration: none;
+ color: white;
+ background-color: #007bff;
+ border-radius: 5px;
+ transition: background-color 0.3s ease;
+ }
+
+ .button:hover {
+ background-color: #0056b3;
+ }
+
\ No newline at end of file
diff --git a/views/document.ejs b/views/document.ejs
new file mode 100644
index 0000000..ad2ae00
--- /dev/null
+++ b/views/document.ejs
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html lang="fr">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Signup Page</title>
+ <link rel="stylesheet" href="/css/spreadsheet-style.css">
+</head>
+
+<body>
+ <%- include('partials/header') %>
+ <div class="spreadsheet-container">
+ <table>
+ <% for(let row = 0; row < 18; row++) { %>
+ <tr>
+ <% for(let col = 0; col < 9; col++) { %>
+ <% if(row === 0) { %>
+ <th><%= String.fromCharCode(65 + col) %></th>
+ <% } else { %>
+ <td contenteditable="true"></td>
+ <% } %>
+ <% } %>
+ </tr>
+ <% } %>
+ </table>
+ </div>
+
+ <script>
+ // JavaScript pour la gestion des événements peut être ajouté ici
+ </script>
+ </body>
+ <%- include('partials/footer') %>
+</html>
diff --git a/views/index.ejs b/views/index.ejs
index e8cb08c..b3a1e8a 100644
--- a/views/index.ejs
+++ b/views/index.ejs
@@ -1,15 +1,24 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
- <title>Index</title>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Accueil</title>
+ <link rel="stylesheet" href="/css/style.css">
</head>
<body>
- <h1>Requête reçu</h1>
- <p> La requête <%= method %> a été reçu à l'adresse <%= url %> </p>
- <% if (locals.user) {%>
- <p>Bonjour <%= locals.user.username %></p>
- <% } else { %>
- <p>Vous n'êtes pas connecté</p>
- <% } %>
+ <div class="home-container">
+ <h1>Bienvenue sur Notre Application de Tableur</h1>
+ <p>Organisez vos données efficacement et en toute simplicité.</p>
+
+ <div class="button-container">
+ <a href="/login" class="button">Se Connecter</a>
+ <a href="/signup" class="button">S'inscrire</a>
+ </div>
+ </div>
+
+ <script>
+ // JavaScript pour d'autres interactions si nécessaire
+ </script>
</body>
</html>
\ No newline at end of file
diff --git a/views/login.ejs b/views/login.ejs
index 995b76d..afaf4f0 100644
--- a/views/login.ejs
+++ b/views/login.ejs
@@ -3,16 +3,19 @@
<head>
<meta charset="UTF-8">
<title>Connexion</title>
+ <link rel="stylesheet" href="/css/style.css">
</head>
<body>
- <h1>Connexion</h1>
- <form action="/login" method="post">
- <input type="text" name="username" value="<%= locals.username ?? '' %>">
- <input type="password" name="password" value="<%= locals.password ?? '' %>">
- <input type="submit" value="Se connecter">
- </form>
- <% if (locals.error) {%>
- <p><%= locals.error %></p>
- <% } %>
+ <div class="signin-container">
+ <h1>Connexion</h1>
+ <form action="/login" method="post">
+ <input type="text" name="username" value="<%= locals.username ?? '' %>">
+ <input type="password" name="password" value="<%= locals.password ?? '' %>">
+ <input type="submit" class="button" value="Se connecter">
+ </form>
+ <% if (locals.error) {%>
+ <p><%= locals.error %></p>
+ <% } %>
+ </div>
</body>
</html>
\ No newline at end of file
diff --git a/views/signup.ejs b/views/signup.ejs
index b914845..fda7562 100644
--- a/views/signup.ejs
+++ b/views/signup.ejs
@@ -26,6 +26,7 @@
</div>
<button type="submit">S'inscrire</button>
</form>
+ <p>Déjà inscrit? <a href="/login">Se connecter</a></p>
</div>
</div>
</body>
--
GitLab