diff src/lib/Shared.luan @ 22:949914955bfe

add menu
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 05 Nov 2024 14:29:16 -0700
parents 435f474f07c7
children c54c806fcc6e
line wrap: on
line diff
--- a/src/lib/Shared.luan	Tue Nov 05 12:57:41 2024 -0700
+++ b/src/lib/Shared.luan	Tue Nov 05 14:29:16 2024 -0700
@@ -92,13 +92,25 @@
 end
 
 function Shared.post_html(post)
-	local author = get_user_by_id(post.author_id)
+	local author_id = post.author_id
+	local user = current_user() or error()
+	local mine = user.id == author_id
+	local author = get_user_by_id(author_id)
 	local id = post.id
 %>
 		<div post="<%=id%>">
 			<div who>
 				<span author><%=author.email%></span>
 				<span when fix><%=post.date%></span>
+<%	if mine then %>
+				<span pulldown>
+					<img onclick="clickMenu(this)" src="/images/more_vert.svg">
+					<div>
+						<span>Edit</span>
+						<span>Delete</span>
+					</div>
+				<span>
+<%	end %>
 			</div>
 			<div text fix><%= html_encode(post.content) %></div>
 		</div>