68 lines
1.8 KiB
Plaintext
68 lines
1.8 KiB
Plaintext
![]() |
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Admin Dashboard</title>
|
||
|
<style>
|
||
|
body {
|
||
|
font-family: -apple-system, system-ui, sans-serif;
|
||
|
max-width: 800px;
|
||
|
margin: 0 auto;
|
||
|
padding: 2rem;
|
||
|
}
|
||
|
.header {
|
||
|
display: flex;
|
||
|
justify-content: space-between;
|
||
|
align-items: center;
|
||
|
margin-bottom: 2rem;
|
||
|
}
|
||
|
.button {
|
||
|
display: inline-block;
|
||
|
padding: 0.5rem 1rem;
|
||
|
background: #007bff;
|
||
|
color: white;
|
||
|
text-decoration: none;
|
||
|
border-radius: 4px;
|
||
|
}
|
||
|
.button.delete {
|
||
|
background: #dc3545;
|
||
|
}
|
||
|
.button.logout {
|
||
|
background: #6c757d;
|
||
|
}
|
||
|
article {
|
||
|
margin-bottom: 2rem;
|
||
|
padding-bottom: 2rem;
|
||
|
border-bottom: 1px solid #eee;
|
||
|
}
|
||
|
.actions {
|
||
|
margin-top: 1rem;
|
||
|
}
|
||
|
.actions form {
|
||
|
display: inline;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="header">
|
||
|
<h1>Admin Dashboard</h1>
|
||
|
<div>
|
||
|
<a href="/admin/new" class="button">New Post</a>
|
||
|
<a href="/admin/logout" class="button logout">Logout</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<% posts.forEach(function(post){ %>
|
||
|
<article>
|
||
|
<h2><%= post.title %></h2>
|
||
|
<div class="date"><%= post.createdAt.toLocaleDateString() %></div>
|
||
|
<%- marked(post.content) %>
|
||
|
<div class="actions">
|
||
|
<a href="/admin/posts/<%= post._id %>/edit" class="button">Edit</a>
|
||
|
<form action="/admin/posts/<%= post._id %>/delete" method="POST" style="display: inline;">
|
||
|
<button type="submit" class="button delete" onclick="return confirm('Are you sure?')">Delete</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</article>
|
||
|
<% }); %>
|
||
|
</body>
|
||
|
</html>
|