Added page indexes for comments, posts, users and pages overall, should
add one for tags but it might be inefficient as I don't store all tags in an array or anything...
This commit is contained in:
@@ -23,6 +23,7 @@ Read the [configuation guide](docs/CONFIG.md) for configuration help (in config.
|
|||||||
* Markdown syntax in posts
|
* Markdown syntax in posts
|
||||||
* Commenting on posts and replying to other comments
|
* Commenting on posts and replying to other comments
|
||||||
* site wide custom CSS
|
* site wide custom CSS
|
||||||
|
* Page indexes
|
||||||
|
|
||||||
# Bugs
|
# Bugs
|
||||||
* probably scales like shit
|
* probably scales like shit
|
||||||
@@ -37,6 +38,7 @@ Read the [configuation guide](docs/CONFIG.md) for configuration help (in config.
|
|||||||
* /postID and /userID pages
|
* /postID and /userID pages
|
||||||
* site index
|
* site index
|
||||||
* Make EJS modification more user friendly
|
* Make EJS modification more user friendly
|
||||||
|
* API for returning posts, users, comments, tags other?...
|
||||||
|
|
||||||
TODO (not finished)
|
TODO (not finished)
|
||||||
# EJS variable names
|
# EJS variable names
|
||||||
|
@@ -141,6 +141,34 @@ app.get("/user/:username/atom", (req,res) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
///////////////////// Page index's ///////////////////////
|
||||||
|
app.get("/index/pages", (req,res) => {
|
||||||
|
res.render("indexes/all_pages", {
|
||||||
|
config,
|
||||||
|
posts,
|
||||||
|
users,
|
||||||
|
comments: comments.comments,
|
||||||
|
});
|
||||||
|
}); // /index/posts
|
||||||
|
app.get("/index/posts", (req,res) => {
|
||||||
|
res.render("indexes/posts", {
|
||||||
|
config,
|
||||||
|
posts,
|
||||||
|
});
|
||||||
|
}); // /index/posts
|
||||||
|
app.get("/index/users", (req,res) => {
|
||||||
|
res.render("indexes/users", {
|
||||||
|
config,
|
||||||
|
users,
|
||||||
|
});
|
||||||
|
}); // /index/posts
|
||||||
|
app.get("/index/comments", (req,res) => {
|
||||||
|
res.render("indexes/comments", {
|
||||||
|
config,
|
||||||
|
comments: comments.comments,
|
||||||
|
});
|
||||||
|
}); // /index/posts
|
||||||
|
|
||||||
|
|
||||||
///////////////////// Standard Pages //////////////////////
|
///////////////////// Standard Pages //////////////////////
|
||||||
app.get("/", (req,res) => {
|
app.get("/", (req,res) => {
|
||||||
|
45
views/indexes/all_pages.ejs
Normal file
45
views/indexes/all_pages.ejs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<%= config.charset %>">
|
||||||
|
<head>
|
||||||
|
<%- include("../partials/head") %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Misc:<br/>
|
||||||
|
<a href="/">Home Page</a><br/>
|
||||||
|
<a href="/index/posts">Posts Index</a><br/>
|
||||||
|
<a href="/index/users">Users Index</a><br/>
|
||||||
|
<a href="/index/comments">Comments Index</a><br/>
|
||||||
|
<a href="<%= config.new_post_url %>">New Post Form</a><br/>
|
||||||
|
<a href="<%= config.signup_url %>">Signup Form</a><br/>
|
||||||
|
Posts:<br/>
|
||||||
|
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
||||||
|
<% if (posts[postID]["deleted"] != true) { %>
|
||||||
|
<a href="/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
||||||
|
<% }; %>
|
||||||
|
<% }; %>
|
||||||
|
Comments:<br/>
|
||||||
|
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
||||||
|
<% for (let comment_index = 0; comment_index < comments[postID].length; comment_index++) { %>
|
||||||
|
<a href="/comment/<%= comments[postID][comment_index]["id"] %>"><%= comments[postID][comment_index]["id"] %></a><br/>
|
||||||
|
<% }; %>
|
||||||
|
<% }; %>
|
||||||
|
Users:<br/>
|
||||||
|
<% for (let userID = 0; userID < users.length; userID++) { %>
|
||||||
|
<% if (users[userID]["deleted"] != true) { %>
|
||||||
|
<a href="/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
||||||
|
<% }; %>
|
||||||
|
<% }; %>
|
||||||
|
Edit Posts:<br/>
|
||||||
|
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
||||||
|
<% if (posts[postID]["deleted"] != true) { %>
|
||||||
|
<a href="/<%= config.edit_post_base_url %>/<%= postID %>">Edit <%= posts[postID]["title"] %></a><br/>
|
||||||
|
<% }; %>
|
||||||
|
<% }; %>
|
||||||
|
Edit Users:<br/>
|
||||||
|
<% for (let userID = 0; userID < users.length; userID++) { %>
|
||||||
|
<% if (users[userID]["deleted"] != true) { %>
|
||||||
|
<a href="/<%= config.edit_account_base_url %>/<%= users[userID]["username"] %>">Edit <%= users[userID]["username"] %></a><br/>
|
||||||
|
<% }; %>
|
||||||
|
<% }; %>
|
||||||
|
</body>
|
||||||
|
</html>
|
13
views/indexes/comments.ejs
Normal file
13
views/indexes/comments.ejs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<%= config.charset %>">
|
||||||
|
<head>
|
||||||
|
<%- include("../partials/head") %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
||||||
|
<% for (let comment_index = 0; comment_index < comments[postID].length; comment_index++) { %>
|
||||||
|
<a href="/comment/<%= comments[postID][comment_index]["id"] %>"><%= comments[postID][comment_index]["id"] %></a><br/>
|
||||||
|
<% }; %>
|
||||||
|
<% }; %>
|
||||||
|
</body>
|
||||||
|
</html>
|
13
views/indexes/posts.ejs
Normal file
13
views/indexes/posts.ejs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<%= config.charset %>">
|
||||||
|
<head>
|
||||||
|
<%- include("../partials/head") %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
||||||
|
<% if (posts[postID]["deleted"] != true) { %>
|
||||||
|
<a href="/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
||||||
|
<% }; %>
|
||||||
|
<% }; %>
|
||||||
|
</body>
|
||||||
|
</html>
|
13
views/indexes/users.ejs
Normal file
13
views/indexes/users.ejs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<%= config.charset %>">
|
||||||
|
<head>
|
||||||
|
<%- include("../partials/head") %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<% for (let userID = 0; userID < users.length; userID++) { %>
|
||||||
|
<% if (users[userID]["deleted"] != true) { %>
|
||||||
|
<a href="/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
||||||
|
<% }; %>
|
||||||
|
<% }; %>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -5,6 +5,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="header">
|
<div id="header">
|
||||||
|
<%- include('../headers/site_wide'); %>
|
||||||
<%- include('../headers/tag'); %>
|
<%- include('../headers/tag'); %>
|
||||||
</div>
|
</div>
|
||||||
<div id="posts">
|
<div id="posts">
|
||||||
|
Reference in New Issue
Block a user