fix ammo group overflow

This commit is contained in:
shibao 2022-03-28 23:56:56 -04:00
parent e0ddefe1d7
commit bad1a23dfe

View File

@ -121,9 +121,10 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
{staged, {staged,
~H""" ~H"""
<div class="min-w-20 py-2 px-4 h-full flex flex-col justify-center items-center">
<button <button
type="button" type="button"
class="btn btn-primary" class="mx-2 my-1 btn btn-primary"
phx-click="toggle_staged" phx-click="toggle_staged"
phx-value-ammo_group_id={ammo_group.id} phx-value-ammo_group_id={ammo_group.id}
> >
@ -132,8 +133,9 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
<%= live_patch(dgettext("actions", "Record shots"), <%= live_patch(dgettext("actions", "Record shots"),
to: Routes.ammo_group_index_path(Endpoint, :add_shot_group, ammo_group), to: Routes.ammo_group_index_path(Endpoint, :add_shot_group, ammo_group),
class: "btn btn-primary" class: "mx-2 my-1 btn btn-primary"
) %> ) %>
</div>
"""} """}
end end
@ -174,11 +176,17 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
defp get_value_for_key("container", %{container: nil}), do: {nil, nil} defp get_value_for_key("container", %{container: nil}), do: {nil, nil}
defp get_value_for_key("container", %{container: %{name: container_name}} = ammo_group) do defp get_value_for_key("container", %{container: %{name: container_name}} = ammo_group) do
assigns = %{ammo_group: ammo_group}
{container_name, {container_name,
live_patch(container_name, ~H"""
to: Routes.ammo_group_index_path(Endpoint, :move, ammo_group), <div class="min-w-20 py-2 px-4 h-full space-x-4 flex justify-center items-center">
<%= live_patch(@ammo_group.container.name,
to: Routes.ammo_group_index_path(Endpoint, :move, @ammo_group),
class: "btn btn-primary" class: "btn btn-primary"
)} ) %>
</div>
"""}
end end
defp get_value_for_key(key, ammo_group), defp get_value_for_key(key, ammo_group),