New post button.

Fix index "page" param not being honored.

Signed-off-by: Armored Dragon <publicmail@armoreddragon.com>
pull/1/head
Armored Dragon 2024-04-24 05:21:32 -05:00
parent e0b530c606
commit e59d3a98f6
Signed by: ArmoredDragon
GPG Key ID: C7207ACC3382AD8B
5 changed files with 39 additions and 3 deletions

View File

@ -13,7 +13,7 @@ async function index(request, response) {
// const is_setup_complete = core.settings["SETUP_COMPLETE"];
// if (!is_setup_complete) return response.redirect("/register");
const blog_list = await core.getPost({ requester_id: request.session.user?.id, page: request.query.page || 0 });
const blog_list = await core.getPost({ requester_id: request.session.user?.id }, {}, { page: request.query.page || 0 });
const tags = await core.getTags();
blog_list.data.forEach((post) => {

View File

@ -154,6 +154,20 @@
.page {
display: flex;
flex-direction: column;
}
.horizontal-button-container {
background-color: white;
box-shadow: rgba(0, 0, 0, 0.1098039216) 0 0px 5px;
margin-top: 2rem;
padding: 1rem;
box-sizing: border-box;
flex-direction: column;
border-radius: 5px;
}
.horizontal-button-container button {
height: 2rem;
}
.search {

View File

@ -171,6 +171,21 @@
.page {
display: flex;
flex-direction: column;
}
.horizontal-button-container {
background-color: white;
// min-height: 100px;
box-shadow: #0000001c 0 0px 5px;
margin-top: 2rem;
padding: 1rem;
box-sizing: border-box;
flex-direction: column;
border-radius: 5px;
button {
height: 2rem;
}
}
.search {
margin-top: 2rem;

View File

@ -10,6 +10,13 @@
<%- include("partials/header.ejs") %>
<div class="page">
<%if(logged_in_user) {%>
<div class="page-center">
<div class="horizontal-button-container">
<button onclick="window.location = '/post/new'" class="button"><span>New Post</span></button>
</div>
</div>
<%}%>
<div class="page-center">
<div class="post-list-container">
<div class="post-list">

View File

@ -4,7 +4,7 @@
<a href="<%= loaded_page %>?page=<%= Number(current_page) - 1 %>" class="left button"><span>< Previous</span></a>
</a>
<% } else {%>
<a href="#" class="left button disabled"><span>< Previous</span></a>
<button href="#" class="left button disabled"><span>< Previous</span></button>
<%}%>
<!-- -->
<div class="pages">
@ -18,6 +18,6 @@
<% if(pagination.includes(Number(current_page) + 1)) {%>
<a href="<%= loaded_page %>?page=<%= Number(current_page) + 1 %>" class="right button"><span>Next ></span></a>
<% } else {%>
<a href="#" class="right button disabled"><span>Next ></span></a>
<button class="right button disabled"><span>Next ></span></button>
<%}%>
</div>