Skip to content

Commit

Permalink
Use map search instead of zone selector
Browse files Browse the repository at this point in the history
Remove the zone dropdown and instead drive zone selection with the search function of the map.
  • Loading branch information
jdudley1123 committed Nov 25, 2024
1 parent 0072889 commit 011370e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/javascript/controllers/map_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ export default class MapController extends Controller {
"poi",
],
})
.on("pick", (e) => {
this.updatePredictionZone(e.feature?.geometry?.coordinates);
})
.addTo(this.map);
}

Expand Down
5 changes: 1 addition & 4 deletions app/views/forecasts/_location_selector.html.erb
Original file line number Diff line number Diff line change
@@ -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" } %>
Expand Down

0 comments on commit 011370e

Please sign in to comment.