diff --git a/lib/arrow_web/live/shuttle_live/shuttle_live.ex b/lib/arrow_web/live/shuttle_live/shuttle_live.ex index f9607057..f84e18c6 100644 --- a/lib/arrow_web/live/shuttle_live/shuttle_live.ex +++ b/lib/arrow_web/live/shuttle_live/shuttle_live.ex @@ -260,6 +260,17 @@ defmodule ArrowWeb.ShuttleViewLive do end end + def handle_event("live_select_change", %{"text" => text, "id" => live_select_id}, socket) do + shapes = + Shuttles.list_shapes() + |> Enum.filter(&(String.downcase(&1.name) |> String.contains?(String.downcase(text)))) + |> Enum.map(&option_mapper/1) + + send_update(LiveSelect.Component, id: live_select_id, options: shapes) + + {:noreply, socket} + end + def handle_event("add_stop", %{"value" => direction_id}, socket) do direction_id = String.to_existing_atom(direction_id) @@ -323,15 +334,4 @@ defmodule ArrowWeb.ShuttleViewLive do route_changeset end end - - def handle_event("live_select_change", %{"text" => text, "id" => live_select_id}, socket) do - shapes = - Shuttles.list_shapes() - |> Enum.filter(&(String.downcase(&1.name) |> String.contains?(String.downcase(text)))) - |> Enum.map(&option_mapper/1) - - send_update(LiveSelect.Component, id: live_select_id, options: shapes) - - {:noreply, socket} - end end