diff --git a/app/javascript/controllers/map_controller.js b/app/javascript/controllers/map_controller.js index b6dd6951..0da32598 100644 --- a/app/javascript/controllers/map_controller.js +++ b/app/javascript/controllers/map_controller.js @@ -155,6 +155,9 @@ export default class MapController extends Controller { "poi", ], }) + .on("pick", (e) => { + this.updatePredictionZone(e.feature?.geometry?.coordinates); + }) .addTo(this.map); } diff --git a/app/views/forecasts/_location_selector.html.erb b/app/views/forecasts/_location_selector.html.erb index 555a2d43..b718e351 100644 --- a/app/views/forecasts/_location_selector.html.erb +++ b/app/views/forecasts/_location_selector.html.erb @@ -1,8 +1,5 @@ <%= form_tag(false, method: :get, id: "forecast-form", data: { "turbo-stream": "replace", "action": "submit->map#updateMap"}) do %> - <%= select_tag :zone, - options_for_select(Zone.all.order(:name).map(&:name), @zone.name), - data: { "forecast-target": "zoneSelector", action: "change->forecast#changeZone" } - %> + <%= hidden_field_tag :zone, @zone.name, data: { "forecast-target": "zoneSelector", "map-target": "zoneSelector", action: "change->forecast#changeZone" } %> <%= hidden_field_tag :date, @date, data: { "forecast-target": "daySelector", "map-target": "daySelector" } %> <%= hidden_field_tag :lat, @map_lat, data: { "map-target": "latField" } %> <%= hidden_field_tag :lng, @map_lng, data: { "map-target": "lngField" } %>