terrastories
terrastories copied to clipboard
Use MapLibre across Rails for offline environment
Addresses the other chunk of the work described in https://github.com/Terrastories/terrastories/issues/882 (along with #943).
This PR implements MapLibre for the different Rails dashboard views that use a map, and also renames mapbox_style
to map_style
across the app.
- Added
maplibre-gl
to package.json (also done in #943 but added here for completeness and testing purposes) - Import
maplibre-gl
indashboard.js
to make it available in Rails. - For Places edit form, Places show view, Stories show view, and Theme edit form, conditionally use either Mapbox or Maplibre depending on the Rails environment.
- Migration to rename
mapbox_style_url
tomap_style_url
. - Rename
mapbox_style
tomap_style
andmapbox_style_url
tomap_style_url
where found.
(Map from Tileserver-GL / Maplibre)
As of today, this PR is pulling in both mapbox and maplibre which will unnecessarily bloat our assets. We will need to find a way to dynamically determine pulling only one of the two libraries as per the Rails environment, env vars, or a different means.