Terrastories / terrastories

Terrastories is a geostorytelling application for mapping, managing and sharing place-based stories.
https://terrastories.app
MIT License
319 stars 157 forks source link

[Rails] Add the ability for an admin user to upload their own SVG Home icon for the map controls #947

Open rudokemper opened 1 year ago

rudokemper commented 1 year ago

Long ago, we customized the standard Mapbox map controls home icon to be a house of the Matawai community:

!https://user-images.githubusercontent.com/31662219/193146179-f0f260d3-b682-4de7-88fe-06ae4466a2aa.png

The intent was always to allow for communities to modify this icon to make it their own, but we haven't gotten around to it until now.

Let's make it possible by allowing an admin user to upload an SVG icon via the CMS dashboard themes page (/member/theme/edit). Then, let's modify the createHomeButton() function in Map.jsx to set .home-icon background-image to the community's own SVG icon, or fallback to the existing one in our assets.

This may require some testing of different SVGs to ensure that it will work; there could be some idiosyncrasies to the SVG file structure that prevent it from rendering, in which case we could possibly add some validations.

Acceptance criteria:

LogPRose commented 11 months ago

Hello! I am quite new to Rails, I just wanted to ensure that I was editing code in the correct place. for the Map.jsx the dir is /rails/app/javascript/components/Map.jsx/ and for creating the place to upload the SVG icon would be /rails/views/dashboard/themes/edit.html.erb/. Thanks!