-
Notifications
You must be signed in to change notification settings - Fork 0
/
reserve.ejs
58 lines (56 loc) · 2.72 KB
/
reserve.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blog</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
</head>
<body>
<div class="container">
<a href="/logout" class="btn btn-primary">Log out</a>
<div class="mb-4 d-flex p-2">
<a href="/profile/show">
<img src="<%= image %>" alt="" class="rounded" width="80px" height="80px">
</a>
<span> <%= name %> </span>
</div>
<h1 class="mb-4">Blog articles</h1>
<a href="articles/new" class="btn btn-success">New article</a>
<% articles.forEach(article => { %>
<% if (article.user == userID) { %>
<div class="card mt-4">
<div class="card-body">
<h4 class="card-title"><%= article.title %></h4>
<div class="card-subtitle text-muted mb-2">
<%= article.createdAt.toLocaleDateString() %>
</div>
<div class="card-text mb-2">
<%= article.description %>
</div>
<a href="/articles/<%= article.slug %>" class="btn btn-primary">Read More</a>
<a href="articles/edit/<%= article.id %>" class="btn btn-info">Edit</a>
<form action="/articles/<%= article.id %>?_method=DELETE" method="POST" class="d-inline">
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</div>
</div>
<%} else { %>
<div class="card mt-4">
<div class="card-body">
<h4 class="card-title"><%= article.title %></h4>
<div class="card-subtitle text-muted mb-2">
<%= article.createdAt.toLocaleDateString() %>
</div>
<div class="card-text mb-2">
<%= article.description %>
</div>
<a href="/articles/<%= article.slug %>" class="btn btn-primary">Read More</a>
</div>
</div>
<% } %>
<% }) %>
</div>
</body>
</html>