Files
something-erlang/lib/something_erlang_web/live/thread_live/index.html.heex
2022-05-23 15:57:15 +02:00

42 lines
1.2 KiB
Plaintext

<h1>Listing Threads</h1>
<%= if @live_action in [:new, :edit] do %>
<.modal return_to={Routes.thread_index_path(@socket, :index)}>
<.live_component
module={SomethingErlangWeb.ThreadLive.FormComponent}
id={@thread.id || :new}
title={@page_title}
action={@live_action}
thread={@thread}
return_to={Routes.thread_index_path(@socket, :index)}
/>
</.modal>
<% end %>
<table>
<thead>
<tr>
<th>Title</th>
<th>Thread</th>
<th></th>
</tr>
</thead>
<tbody id="threads">
<%= for thread <- @threads do %>
<tr id={"thread-#{thread.id}"}>
<td><%= thread.title %></td>
<td><%= thread.thread_id %></td>
<td>
<span><%= live_redirect "Show", to: Routes.thread_show_path(@socket, :show, thread) %></span>
<span><%= live_patch "Edit", to: Routes.thread_index_path(@socket, :edit, thread) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: thread.id, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= live_patch "New Thread", to: Routes.thread_index_path(@socket, :new) %></span>