Aggiedit/lib/aggiedit_web/live/post_live/show.html.heex
2022-04-14 13:56:10 -06:00

38 lines
893 B
Plaintext

<h1>Show Post</h1>
<%= if @live_action in [:edit] do %>
<.modal return_to={Routes.post_show_path(@socket, :show, @room, @post)}>
<.live_component
module={AggieditWeb.PostLive.FormComponent}
id={@post.id}
current_user={@current_user}
title={@page_title}
action={@live_action}
post={@post}
return_to={Routes.post_show_path(@socket, :show, @room, @post)}
/>
</.modal>
<% end %>
<ul>
<li>
<strong>Title:</strong>
<%= @post.title %>
</li>
<li>
<strong>Body:</strong>
<%= @post.body %>
</li>
</ul>
<span><%= live_patch "Edit", to: Routes.post_show_path(@socket, :edit, @room, @post), class: "button" %></span> |
<span><%= live_redirect "Back", to: Routes.post_index_path(@socket, :index, @room) %></span>
<script>
window.userSocket.connect();
window.RoomChat.init(window.userSocket, <%= @post.id %>)
</script>