From cccc5aafc718cd86dd43fa854ce1908d5ab36ced Mon Sep 17 00:00:00 2001 From: shibao Date: Tue, 1 Feb 2022 00:12:09 -0500 Subject: [PATCH] add blank ammo types page --- .../live/ammo_type_live/index.html.heex | 74 +++++++++++-------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/lib/cannery_web/live/ammo_type_live/index.html.heex b/lib/cannery_web/live/ammo_type_live/index.html.heex index f70ca9e..d894d71 100644 --- a/lib/cannery_web/live/ammo_type_live/index.html.heex +++ b/lib/cannery_web/live/ammo_type_live/index.html.heex @@ -3,42 +3,52 @@ Listing Ammo Types - <%= live_patch "New Ammo type", - to: Routes.ammo_type_index_path(@socket, :new), - class: "btn btn-primary" %> + <%= if @ammo_types |> Enum.empty?() do %> +

+ No Ammo Types 😔 +

-
- - - - - - - - + <%= live_patch "Add your first type!", + to: Routes.ammo_type_index_path(@socket, :new), + class: "btn btn-primary" %> + <% else %> + <%= live_patch "New Ammo type", + to: Routes.ammo_type_index_path(@socket, :new), + class: "btn btn-primary" %> - - - - - <%= for ammo_type <- @ammo_types do %> - - - - - - +
+
NameCase materialBullet typeGrainManufacturer
<%= ammo_type.name %><%= ammo_type.case_material %><%= ammo_type.bullet_type %><%= ammo_type.grain %><%= ammo_type.manufacturer %>
+ + + + + + + - + - <% end %> - -
NameCase materialBullet typeGrainManufacturer - <%= live_redirect "Show", to: Routes.ammo_type_show_path(@socket, :show, ammo_type) %> - <%= live_patch "Edit", to: Routes.ammo_type_index_path(@socket, :edit, ammo_type) %> - <%= link "Delete", to: "#", phx_click: "delete", phx_value_id: ammo_type.id, data: [confirm: "Are you sure?"] %> -
-
+ + + <%= for ammo_type <- @ammo_types do %> + + <%= ammo_type.name %> + <%= ammo_type.case_material %> + <%= ammo_type.bullet_type %> + <%= ammo_type.grain %> + <%= ammo_type.manufacturer %> + + + <%= live_redirect "Show", to: Routes.ammo_type_show_path(@socket, :show, ammo_type) %> + <%= live_patch "Edit", to: Routes.ammo_type_index_path(@socket, :edit, ammo_type) %> + <%= link "Delete", to: "#", phx_click: "delete", phx_value_id: ammo_type.id, data: [confirm: "Are you sure?"] %> + + + <% end %> + + + + <% end %> <%= if @live_action in [:new, :edit] do %>