2022-03-13 16:16:46 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
2022-08-11 00:38:44 +03:00
|
|
|
<%- include("extra/header", { title: thread.title }) %>
|
2022-03-26 23:28:10 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<body>
|
2022-03-26 23:28:10 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<%- include("extra/navbar", {user}) %>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<h1 style="font-size: 35px;">
|
|
|
|
<%= thread.title %>
|
|
|
|
</h1>
|
2022-08-10 00:44:13 +03:00
|
|
|
|
|
|
|
<h2 style="display:inline;">By <a href=<%="/users/" + thread.author.id %>> <%= thread.author.name %></a>
|
2022-04-03 21:01:55 +03:00
|
|
|
<img class="yuvarlak" src=<%= thread.author.avatar %> alt=<%= thread.author.name %>>
|
|
|
|
</h2>
|
2022-08-10 00:44:13 +03:00
|
|
|
|
2022-08-11 02:43:15 +03:00
|
|
|
<% if (user && !thread.deleted){ %>
|
2022-08-10 00:44:13 +03:00
|
|
|
|
2022-08-11 02:43:15 +03:00
|
|
|
<button id="delete_thread" value="<%= thread.id %>" style="display:inline;" type="submit">DELETE</button>
|
|
|
|
<button id="edit_thread" style="display:inline;" type="submit">EDIT</button>
|
|
|
|
<% } else { %>
|
|
|
|
<h3 style="display:inline;">This thread has been deleted</h3>
|
2022-08-10 00:44:13 +03:00
|
|
|
<% }; %>
|
|
|
|
|
2022-08-11 00:38:44 +03:00
|
|
|
<hr>
|
|
|
|
<div id="messages">
|
2022-04-03 21:01:55 +03:00
|
|
|
<% messages.forEach(message=>{ %>
|
2022-04-06 21:14:46 +03:00
|
|
|
<% if (message){ %>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<div id="message-<%= message.id %>" style="border: 2px solid #444444; padding: 10px;">
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<h3 style="float:right;">
|
|
|
|
<%=new Date(message.time).toLocaleString() %>
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<h2>
|
|
|
|
<img class="yuvarlak" src=<%=message.author.avatar %> alt=<%= message.author.name %>>
|
2022-08-10 00:22:12 +03:00
|
|
|
<a href=<%="/users/" + message.author.id %>> <%= message.author.name %></a>:
|
2022-04-03 21:01:55 +03:00
|
|
|
</h2>
|
|
|
|
|
|
|
|
<h2>
|
|
|
|
<%= message.content %>
|
|
|
|
</h2>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<br>
|
|
|
|
|
|
|
|
<% if (user){ %>
|
2022-08-11 02:43:15 +03:00
|
|
|
<% if (!message.deleted){ %>
|
|
|
|
<form style="display:inline;">
|
|
|
|
<button id="delete_message" value="<%= message.id %>" type="submit">DELETE</button>
|
2022-04-03 21:01:55 +03:00
|
|
|
</form>
|
2022-08-11 02:43:15 +03:00
|
|
|
<% } else { %>
|
|
|
|
<h3 style="display:inline;">This message has been deleted</h3>
|
|
|
|
<% }; %>
|
|
|
|
|
2022-08-11 00:38:44 +03:00
|
|
|
<div style="float: right;">
|
|
|
|
<h3 id="count<%= message.id %>" style="display:inline;"><%= message.reactCount %></h3>
|
|
|
|
<button style="display:inline;" id="like" value="<%= message.id %>">+🔼</button>
|
|
|
|
<button style="display:inline;" id="dislike" value="<%= message.id %>" >-🔽</button>
|
|
|
|
</div>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-08-11 00:38:44 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<% } %>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
</div>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-04-06 21:14:46 +03:00
|
|
|
<% } else { %>
|
|
|
|
<div id="deleted-message" style="border: 2px solid #444444; padding: 10px;">
|
|
|
|
<h1>DELETED MESSAGE</h1>
|
|
|
|
</div>
|
|
|
|
<% } %>
|
|
|
|
<br>
|
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<% }); %>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-08-11 02:43:15 +03:00
|
|
|
|
2022-08-11 00:38:44 +03:00
|
|
|
</div>
|
2022-08-11 02:43:15 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<hr>
|
2022-03-21 23:53:22 +03:00
|
|
|
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-08-11 00:38:44 +03:00
|
|
|
<form id= "send">
|
2022-05-01 17:21:40 +03:00
|
|
|
<textarea rows="4" cols="133" name="content"></textarea>
|
2022-04-03 21:01:55 +03:00
|
|
|
<input name="threadID" type="hidden" value="<%= thread.id %>"></input>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
<% if (user){ %>
|
|
|
|
<button type="submit">Send!</button>
|
2022-08-11 00:38:44 +03:00
|
|
|
<%} else {%>
|
|
|
|
<button disabled>Login for send</button>
|
|
|
|
<% }%>
|
2022-04-03 21:01:55 +03:00
|
|
|
|
|
|
|
</form>
|
2022-08-11 00:38:44 +03:00
|
|
|
<% if (user){ %>
|
2022-08-11 02:43:15 +03:00
|
|
|
<script type="module" src="/js/thread.js"></script>
|
2022-08-11 00:38:44 +03:00
|
|
|
<% }%>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<%- include("extra/footer") %>
|
|
|
|
</body>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-05-01 17:21:40 +03:00
|
|
|
</html>
|