forked from shibao/cannery
remove default boolean columns if all false
This commit is contained in:
parent
4ff2f64a22
commit
bf27511caa
@ -2,6 +2,7 @@
|
||||
- Add or remove tags from Containers list and details page
|
||||
- Show tags on containers
|
||||
- Add "Cannery" to page titles
|
||||
- Don't show true/false column for ammo types if all values are false
|
||||
|
||||
|
||||
# 0.1.0
|
||||
|
@ -73,6 +73,14 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
|
||||
|> Enum.filter(fn {_label, field, _type} ->
|
||||
ammo_types |> Enum.any?(fn ammo_type -> not (ammo_type |> Map.get(field) |> is_nil()) end)
|
||||
end)
|
||||
# if boolean, remove if all values are false
|
||||
|> Enum.filter(fn {_label, field, type} ->
|
||||
if type == :boolean do
|
||||
ammo_types |> Enum.any?(fn ammo_type -> not (ammo_type |> Map.get(field) == false) end)
|
||||
else
|
||||
true
|
||||
end
|
||||
end)
|
||||
|
||||
socket |> assign(ammo_types: ammo_types, columns_to_display: columns_to_display)
|
||||
end
|
||||
|
@ -108,9 +108,11 @@
|
||||
<%= if @ammo_groups |> Enum.empty?() do %>
|
||||
<%= gettext("No ammo for this type") %>
|
||||
<% else %>
|
||||
<div class="flex flex-wrap justify-center items-center">
|
||||
<%= for ammo_group <- @ammo_groups do %>
|
||||
<.ammo_group_card ammo_group={ammo_group} />
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user