forked from hiway/freedive
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
|
def(handle_event("tap", %{"name" => item_name}, socket)) do
|
||||||
# 1 tap to select, 2 taps for details
|
# 1 tap to select, 2 taps for details
|
||||||
item = socket.assigns.items[item_name]
|
item = socket.assigns.items[item_name]
|
||||||
|
|
||||||
socket =
|
socket =
|
||||||
case socket.assigns.selected_item do
|
case socket.assigns.selected_item do
|
||||||
nil ->
|
nil ->
|
||||||
|
@ -81,8 +82,6 @@ defmodule FreediveWeb.LiliformLive do
|
||||||
assign(socket, %{selected_item: item, details: nil})
|
assign(socket, %{selected_item: item, details: nil})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
IO.inspect(socket.assigns.selected_item, label: "selected_item")
|
|
||||||
IO.inspect(socket.assigns.details, label: "details")
|
|
||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -98,10 +97,7 @@ defmodule FreediveWeb.LiliformLive do
|
||||||
items
|
items
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
Enum.filter(items, fn {_, item} ->
|
items |> Enum.filter(fn {_name, item} -> item[key] == true end)
|
||||||
Map.get(item, key) == true
|
|
||||||
end)
|
|
||||||
Enum.into(%{}, items)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue