blob: 01334995e6458f7bbb56088f133331fac1c9e262 (
plain)
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
|
<%- include('../partials/header') %>
<div class='content'>
<div class='leftie'>
<ul>
<% if(!currentUser) { %>
<li><a href='/search/all'>Search for blog posts</a></li>
<li><a href='/'>About</a></li>
<li><a href='/browsers'>Minimal browsers</a></li>
<% } else { %>
<li><a href='/blog/<%= currentUser.username %>'>My Blog</a></li>
<li><a href='/blog/<%= currentUser.username %>/new'>Create a blog post</a></li>
<li><a href='/search/all'>Search for blog posts</a></li>
<li><a href='/'>About</a></li>
<li><a href='/browsers'>Minimal browsers</a></li>
<% } %>
</ul>
</div>
<div class='rightie'>
<h3><a id='pbname' href="/blog/<%= account %>"><%= account.toUpperCase() %></a></h3>
<div class='showPost'>
<h4><%= post.title %></h4>
<img src="<%= post.image %>" alt="...">
<span><button><%= post.tag %></button></span>
<p><%- post.body %></p>
<% if(currentUser && post.author.id.equals(currentUser._id)) { %>
<a id='edit' href="/blog/<%= currentUser.username %>/<%= post._id %>/edit">Edit</a>
<form id="deleteForm" action="/blog/<%= currentUser.username %>/<%= post._id %>?_method=DELETE" method="POST">
<button class='deleteBtn' type='submit'>Delete</button>
</form>
<% } %>
<% post.comments.map((comment) => { %>
<div class='comment'>
<h5><%= comment.author.username.toUpperCase() %>: </h5>
<p><%- comment.text %></p>
<% if(currentUser && comment.author.id.equals(currentUser._id)) { %>
<div class='cmmntOps'>
<a id="edCmmnt" href="/blog/<%= account %>/<%= post._id %>/comments/<%= comment._id %>/edit">
Edit
</a>
<form id="deleteForm" action='/blog/<%= account %>/<%= post._id %>/comments/<%= comment._id %>?_method=DELETE' method="POST">
<button class='deleteBtn' type='submit'>Delete</button>
</form>
</div>
<% } %>
</div>
<% }) %>
<a id='edit' href="/blog/<%= account %>/<%= post._id %>/comments/new">Add a comment</a>
</div>
</div>
</div>
<%- include('../partials/footer') %>
|