Skip to content

Commit

Permalink
Merge pull request #212 from josem-gp/map-route-markers
Browse files Browse the repository at this point in the history
Fixed map so that when routing on the destination marker shows
  • Loading branch information
kenntheswe committed Jun 9, 2021
2 parents b91058b + 29ab62a commit dda519d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit dda519d

Please sign in to comment.