forked from shibao/cannery
fix ammo group overflow
This commit is contained in:
parent
e0ddefe1d7
commit
bad1a23dfe
@ -121,19 +121,21 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
|
|||||||
|
|
||||||
{staged,
|
{staged,
|
||||||
~H"""
|
~H"""
|
||||||
<button
|
<div class="min-w-20 py-2 px-4 h-full flex flex-col justify-center items-center">
|
||||||
type="button"
|
<button
|
||||||
class="btn btn-primary"
|
type="button"
|
||||||
phx-click="toggle_staged"
|
class="mx-2 my-1 btn btn-primary"
|
||||||
phx-value-ammo_group_id={ammo_group.id}
|
phx-click="toggle_staged"
|
||||||
>
|
phx-value-ammo_group_id={ammo_group.id}
|
||||||
<%= if ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %>
|
>
|
||||||
</button>
|
<%= if ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %>
|
||||||
|
</button>
|
||||||
|
|
||||||
<%= 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">
|
||||||
class: "btn btn-primary"
|
<%= live_patch(@ammo_group.container.name,
|
||||||
)}
|
to: Routes.ammo_group_index_path(Endpoint, :move, @ammo_group),
|
||||||
|
class: "btn btn-primary"
|
||||||
|
) %>
|
||||||
|
</div>
|
||||||
|
"""}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(key, ammo_group),
|
defp get_value_for_key(key, ammo_group),
|
||||||
|
Loading…
Reference in New Issue
Block a user