add comments

This commit is contained in:
biglyderv 2024-11-25 14:12:43 -05:00
parent e8cc01e66f
commit 59c1daeac5
11 changed files with 94 additions and 11 deletions

21
views/comments.ejs Normal file
View file

@ -0,0 +1,21 @@
<form enctype='multipart/form-data' method='POST' action='/api/form/comment'>
<h1>Comments</h1>
<!-- probably component-ify this -->
<div class='form-message'></div>
<input name='targetId' hidden value='<%= id %>'>
<input name='targetType' hidden value='<%= route %>'>
<textarea name='content'></textarea>
<input type='submit'>
<% for (let comment of comments) { %>
<div class='comment'>
<div><b>
<a href='/client/user?id=<%= comment.username %>'><%= comment.username %></a>
</b></div>
<div><b>
<%= (new Date(comment.date)+'').split(/(GMT|UTC)/g)[0] %>
</b></div>
<pre><%= comment.content %></pre>
</div>
<% } %>
</form>

View file

@ -19,4 +19,5 @@
</a></div>
<pre><%= videoData.desc %></pre>
</div>
<%- include('comments.ejs') -%>
<%- include('footer.ejs') -%>

View file

@ -14,4 +14,5 @@
<%- include('videos.ejs') -%>
</div>
</div>
<%- include('comments.ejs') -%>
<%- include('footer.ejs') -%>