From 1e5cd0790ba6f89a2f074f45a8e406069287e5d9 Mon Sep 17 00:00:00 2001 From: Kwstas Drakontidis Date: Sat, 7 Jun 2025 10:12:47 +0200 Subject: [PATCH] Code refactor --- app/routes/private_routes.js | 5 +++++ app/views/about.ejs | 5 ++++- app/views/add.ejs | 8 +++++++- app/views/edit.ejs | 8 +++++++- app/views/error.ejs | 5 ++++- app/views/index.ejs | 5 ++++- samples/app.conf.sample | 1 + src/javascript/add.js | 7 ++----- src/javascript/edit.js | 9 ++------- src/javascript/index.js | 4 ++-- 10 files changed, 38 insertions(+), 19 deletions(-) diff --git a/app/routes/private_routes.js b/app/routes/private_routes.js index 8823334..897592a 100644 --- a/app/routes/private_routes.js +++ b/app/routes/private_routes.js @@ -13,6 +13,7 @@ const router = express.Router(); function errorPageRenderer(res, emoji, message) { res.render("error", { page_title: app_conf.name, + program: app_conf.program, css_path: path.join(app_conf.paths.css.web, "stylesheet.css"), js_path: path.join(app_conf.paths.js.web, "error.js"), error_emoji: emoji, @@ -180,6 +181,7 @@ router.get("/add", async (req, res) => { table_data += ""; res.render("add", { page_title: app_conf.name, + program: app_conf.program, css_path: path.join(app_conf.paths.css.web, "stylesheet.css"), js_path: path.join(app_conf.paths.js.web, "add.js"), column_options: JSON.stringify(column_options), @@ -246,6 +248,7 @@ router.get("/edit", async (req, res) => { res.render("edit", { page_title: app_conf.name, + program: app_conf.program, css_path: path.join(app_conf.paths.css.web, "stylesheet.css"), js_path: path.join(app_conf.paths.js.web, "edit.js"), column_options: JSON.stringify(column_options), @@ -293,6 +296,7 @@ router.get("/", async (req, res) => { res.render("index", { page_title: app_conf.name, + program: app_conf.program, css_path: path.join(app_conf.paths.css.web, "stylesheet.css"), js_path: path.join(app_conf.paths.js.web, "index.js"), table_header: table_header, @@ -310,6 +314,7 @@ router.get("/", async (req, res) => { router.get("/about", (req, res) => { res.render("about", { page_title: app_conf.name, + program: app_conf.program, css_path: path.join(app_conf.paths.css.web, "stylesheet.css"), version: app_conf.version }); diff --git a/app/views/about.ejs b/app/views/about.ejs index 09a46ae..c020fa0 100644 --- a/app/views/about.ejs +++ b/app/views/about.ejs @@ -17,7 +17,10 @@
- +
diff --git a/app/views/add.ejs b/app/views/add.ejs index a94fe8f..9c9afdc 100644 --- a/app/views/add.ejs +++ b/app/views/add.ejs @@ -21,7 +21,10 @@
- +
@@ -36,6 +39,9 @@
+
+
About
+
\ No newline at end of file diff --git a/app/views/edit.ejs b/app/views/edit.ejs index 751021e..6b3e499 100644 --- a/app/views/edit.ejs +++ b/app/views/edit.ejs @@ -21,7 +21,10 @@
- +
@@ -39,6 +42,9 @@
+
+
About
+
\ No newline at end of file diff --git a/app/views/error.ejs b/app/views/error.ejs index 5577e3d..3b47fd0 100644 --- a/app/views/error.ejs +++ b/app/views/error.ejs @@ -19,7 +19,10 @@
- +
diff --git a/app/views/index.ejs b/app/views/index.ejs index 2ada1a6..05c2523 100644 --- a/app/views/index.ejs +++ b/app/views/index.ejs @@ -19,7 +19,10 @@
- +