Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed map so that when routing on the destination marker shows #212

Merged
merged 1 commit into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/controllers/parkings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ def index
if params[:to_parking].present?
@parking = Parking.find(params[:to_parking])
@destination = [@parking.longitude, @parking.latitude]
@markers = [{
lat: @parking.latitude,
lng: @parking.longitude,
marker: render_to_string(partial: "marker", locals: { parking: @parking })
}]
end
@favorite_parkings = current_user.favorited_by_type('Parking')
end
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/plugins/init_mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ const initMapbox = () => {
},
trackUserLocation: true,
fitBoundsOptions: {
maxZoom: 13
maxZoom: 15
}
});

// Add geolocate control button to the map.
map.addControl(geolocate, 'bottom-right');

if (mapElement.dataset.destination) {
Expand Down