<h1>Listing Layouts</h1>
<%= if @live_action in [:new, :edit] do %>
<.modal return_to={Routes.layout_index_path(@socket, :index)}>
<.live_component
module={CakeWeb.LayoutLive.FormComponent}
id={@layout.id || :new}
title={@page_title}
action={@live_action}
layout={@layout}
return_to={Routes.layout_index_path(@socket, :index)}
/>
</.modal>
<% end %>
<table>
<thead>
<tr>
<th>Name</th>
<th>Version</th>
<th></th>
</tr>
</thead>
<tbody id="layouts">
<%= for layout <- @layouts do %>
<tr id={"layout-#{layout.id}"}>
<td><%= layout.name %></td>
<td><%= layout.version %></td>
<td>
<span><%= live_redirect "Show", to: Routes.layout_show_path(@socket, :show, layout) %></span>
<span><%= live_patch "Edit", to: Routes.layout_index_path(@socket, :edit, layout) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: layout.id, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= live_patch "New Layout", to: Routes.layout_index_path(@socket, :new) %></span>