Files
malarkey/lib/malarkey_web/live/post_live/show.html.heex
2022-11-25 18:35:00 +00:00

30 lines
872 B
Plaintext

<.header>
Post <%= @post.id %>
<:subtitle>This is a post record from your database.</:subtitle>
<:actions>
<.link patch={~p"/posts/#{@post}/show/edit"} phx-click={JS.push_focus()}>
<.button>Edit post</.button>
</.link>
</:actions>
</.header>
<.list>
<:item title="Username"><%= @post.user.username %></:item>
<:item title="Body"><%= @post.body %></:item>
<:item title="Likes count"><%= @post.likes_count %></:item>
<:item title="Repost count"><%= @post.repost_count %></:item>
</.list>
<.back navigate={~p"/posts"}>Back to posts</.back>
<.modal :if={@live_action == :edit} id="post-modal" show on_cancel={JS.patch(~p"/posts/#{@post}")}>
<.live_component
module={MalarkeyWeb.PostLive.FormComponent}
id={@post.id}
title={@page_title}
action={@live_action}
post={@post}
navigate={~p"/posts/#{@post}"}
/>
</.modal>