You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
906 B
33 lines
906 B
2 years ago
|
<.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.username %></:item>
|
||
|
<:item title="Body"><%= @post.body %></:item>
|
||
|
<:item title="Likes count"><%= @post.likes_count %></:item>
|
||
|
<:item title="Reposts count"><%= @post.reposts_count %></:item>
|
||
|
</.list>
|
||
|
|
||
|
<.back navigate={~p"/posts"}>Back to posts</.back>
|
||
|
|
||
|
<%= if @live_action in [:edit] do %>
|
||
|
<.modal id="post-modal" show on_cancel={JS.patch(~p"/posts/#{@post}")}>
|
||
|
<.live_component
|
||
|
module={ChirpWeb.PostLive.FormComponent}
|
||
|
id={@post.id}
|
||
|
title={@page_title}
|
||
|
action={@live_action}
|
||
|
post={@post}
|
||
|
navigate={~p"/posts/#{@post}"}
|
||
|
/>
|
||
|
</.modal>
|
||
|
<% end %>
|
||
|
|