Clean up, fix filters
This commit is contained in:
parent
9f6e3ddab2
commit
74615f5ac7
1 changed files with 2 additions and 6 deletions
|
@ -61,6 +61,7 @@ defmodule FreediveWeb.LiliformLive do
|
|||
def(handle_event("tap", %{"name" => item_name}, socket)) do
|
||||
# 1 tap to select, 2 taps for details
|
||||
item = socket.assigns.items[item_name]
|
||||
|
||||
socket =
|
||||
case socket.assigns.selected_item do
|
||||
nil ->
|
||||
|
@ -81,8 +82,6 @@ defmodule FreediveWeb.LiliformLive do
|
|||
assign(socket, %{selected_item: item, details: nil})
|
||||
end
|
||||
end
|
||||
IO.inspect(socket.assigns.selected_item, label: "selected_item")
|
||||
IO.inspect(socket.assigns.details, label: "details")
|
||||
{:noreply, socket}
|
||||
end
|
||||
end
|
||||
|
@ -98,10 +97,7 @@ defmodule FreediveWeb.LiliformLive do
|
|||
items
|
||||
|
||||
_ ->
|
||||
Enum.filter(items, fn {_, item} ->
|
||||
Map.get(item, key) == true
|
||||
end)
|
||||
Enum.into(%{}, items)
|
||||
items |> Enum.filter(fn {_name, item} -> item[key] == true end)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue