style ammo type show page
This commit is contained in:
@ -20,6 +20,12 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
|
||||
|> assign(:ammo_type, Ammo.get_ammo_type!(id))}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("delete", _, socket) do
|
||||
socket.assigns.ammo_type |> Ammo.delete_ammo_type!()
|
||||
{:noreply, socket |> push_redirect(to: Routes.ammo_type_index_path(socket, :index))}
|
||||
end
|
||||
|
||||
defp page_title(:show), do: "Show Ammo type"
|
||||
defp page_title(:edit), do: "Edit Ammo type"
|
||||
end
|
||||
|
54
lib/cannery_web/live/ammo_type_live/show.html.heex
Normal file
54
lib/cannery_web/live/ammo_type_live/show.html.heex
Normal file
@ -0,0 +1,54 @@
|
||||
<div class="mx-auto space-y-4 max-w-3xl flex flex-col justify-center items-center">
|
||||
<h1 class="title text-2xl title-primary-500">
|
||||
<%= @ammo_type.name %>
|
||||
</h1>
|
||||
|
||||
<div class="flex space-x-4 justify-center items-center text-primary-500">
|
||||
<%= live_redirect "Back", to: Routes.ammo_type_index_path(@socket, :index), class: "link" %>
|
||||
<%= live_patch "Edit", to: Routes.ammo_type_show_path(@socket, :edit, @ammo_type), class: "button" %>
|
||||
<%= link("Delete",
|
||||
to: "#",
|
||||
class: "link",
|
||||
phx_click: "delete",
|
||||
data: [confirm: "Are you sure you want to delete #{@ammo_type.name}?"]
|
||||
) %>
|
||||
</div>
|
||||
|
||||
<hr class="w-full">
|
||||
|
||||
<ul class="text-center">
|
||||
<li>
|
||||
<strong>Desc:</strong>
|
||||
<%= @ammo_type.desc %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Case material:</strong>
|
||||
<%= @ammo_type.case_material %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Bullet type:</strong>
|
||||
<%= @ammo_type.bullet_type %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Grain:</strong>
|
||||
<%= @ammo_type.grain %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Manufacturer:</strong>
|
||||
<%= @ammo_type.manufacturer %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<%= if @live_action in [:edit] do %>
|
||||
<%= live_modal CanneryWeb.AmmoTypeLive.FormComponent,
|
||||
id: @ammo_type.id,
|
||||
title: @page_title,
|
||||
action: @live_action,
|
||||
ammo_type: @ammo_type,
|
||||
return_to: Routes.ammo_type_show_path(@socket, :show, @ammo_type) %>
|
||||
<% end %>
|
@ -1,47 +0,0 @@
|
||||
<h1>Show Ammo type</h1>
|
||||
|
||||
<%= if @live_action in [:edit] do %>
|
||||
<%= live_modal CanneryWeb.AmmoTypeLive.FormComponent,
|
||||
id: @ammo_type.id,
|
||||
title: @page_title,
|
||||
action: @live_action,
|
||||
ammo_type: @ammo_type,
|
||||
return_to: Routes.ammo_type_show_path(@socket, :show, @ammo_type) %>
|
||||
<% end %>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<strong>Name:</strong>
|
||||
<%= @ammo_type.name %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Desc:</strong>
|
||||
<%= @ammo_type.desc %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Case material:</strong>
|
||||
<%= @ammo_type.case_material %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Bullet type:</strong>
|
||||
<%= @ammo_type.bullet_type %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Weight:</strong>
|
||||
<%= @ammo_type.weight %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Manufacturer:</strong>
|
||||
<%= @ammo_type.manufacturer %>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<span><%= live_patch "Edit", to: Routes.ammo_type_show_path(@socket, :edit, @ammo_type), class: "button" %></span>
|
||||
<span><%= live_redirect "Back", to: Routes.ammo_type_index_path(@socket, :index) %></span>
|
Reference in New Issue
Block a user