From 24e2326dc4ec2433785b0b8f2ec639e81eabc246 Mon Sep 17 00:00:00 2001 From: Johnathon Slightham Date: Thu, 2 Feb 2023 15:26:47 -0500 Subject: [PATCH] Fixed issues with category routes and worked on post routes --- public/consts.js | 25 +++- public/index.html | 24 ++-- public/manageCategories.html | 156 ++++++++++++++++++++++ public/manageHome.html | 69 +++++----- public/managePosts.html | 250 +++++++++++++++++++++++++++++++++++ public/register.html | 12 +- routes/category.route.js | 2 +- routes/post.route.js | 2 +- routes/user.route.js | 11 ++ utils/account.js | 15 ++- utils/viewcount.js | 0 11 files changed, 513 insertions(+), 53 deletions(-) create mode 100644 public/manageCategories.html create mode 100644 public/managePosts.html create mode 100644 utils/viewcount.js diff --git a/public/consts.js b/public/consts.js index 7913e33..d852935 100644 --- a/public/consts.js +++ b/public/consts.js @@ -1 +1,24 @@ -const backendURL = "http://127.0.0.1:8080"; \ No newline at end of file +const backendURL = "http://127.0.0.1:8080"; + +function setCookie(cname, cvalue, exdays) { + const d = new Date(); + d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); + let expires = "expires=" + d.toUTCString(); + document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; +} + +function getCookie(cname) { + let name = cname + "="; + let decodedCookie = decodeURIComponent(document.cookie); + let ca = decodedCookie.split(';'); + for (let i = 0; i < ca.length; i++) { + let c = ca[i]; + while (c.charAt(0) == ' ') { + c = c.substring(1); + } + if (c.indexOf(name) == 0) { + return c.substring(name.length, c.length); + } + } + return ""; +} \ No newline at end of file diff --git a/public/index.html b/public/index.html index 0591f69..35d5b46 100644 --- a/public/index.html +++ b/public/index.html @@ -1,10 +1,12 @@ - - - - + + @@ -46,7 +48,7 @@ - + diff --git a/public/manageCategories.html b/public/manageCategories.html new file mode 100644 index 0000000..2464cc8 --- /dev/null +++ b/public/manageCategories.html @@ -0,0 +1,156 @@ + + + + + + + + +
+

Kno-Logic Management Portal

+ + + + + + + + +
+ Manage Categories +
+ Home + + Manage Posts + + Manage Categories + + Analytics +
+ +
+ + + + + + + + + + + + + +
+ Add Category +
+ + + +
+ + + +
+
+
+ +
+ + + + + + + + + + + +
+ List Categories +
+ Name + + Color +
+
+ + + + + + + \ No newline at end of file diff --git a/public/manageHome.html b/public/manageHome.html index 416a785..73e6dcb 100644 --- a/public/manageHome.html +++ b/public/manageHome.html @@ -1,59 +1,64 @@ - - - - + +

Kno-Logic Management Portal

- - - - - - - - -
- Home -
- Home - - Manage Posts - - Manage Categories - - Analytics -
+ + + + + + + + +
+ Home +
+ Home + + Manage Posts + + Manage Categories + + Analytics +
- + \ No newline at end of file diff --git a/public/managePosts.html b/public/managePosts.html new file mode 100644 index 0000000..f957bad --- /dev/null +++ b/public/managePosts.html @@ -0,0 +1,250 @@ + + + + + + + + +
+

Kno-Logic Management Portal

+ + + + + + + + +
+ Manage Posts +
+ Home + + Manage Posts + + Manage Categories + + Analytics +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Add Post +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ List Posts +
+ Title + + Description + + Author + + Category + + Link + + Date + + Photo + + Edit + + Delete +
+
+ + + + + + + \ No newline at end of file diff --git a/public/register.html b/public/register.html index 239c412..2d68b43 100644 --- a/public/register.html +++ b/public/register.html @@ -1,10 +1,12 @@ - - - - + + @@ -54,7 +56,7 @@ - +