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

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

Open
6 tasks
rudokemper opened this issue Sep 23, 2023 · 1 comment · May be fixed by #983
Open
6 tasks
Labels
beginner friendly Good for newcomers Hacktoberfest Hacktoberfest 2023 rails

Comments

@rudokemper
Copy link
Member

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:

  • A logged in community admin navigates to the Theme edit view in the CMS and sees an option to upload a SVG icon with the label "Custom Home Button", at the bottom the section Map Settings.
  • Only a SVG is permitted to be uploaded.
  • The community admin may delete, or replace the SVG.
  • Upon successful upload, the SVG is used for the Home icon on the Map view (/home).
  • The SVG is formatted to fit within the square width/height of the Home icon container.
  • If the SVG is deleted, then the fallback SVG in the assets dir of Terrastories.
@rudokemper rudokemper added beginner friendly Good for newcomers rails Hacktoberfest Hacktoberfest 2023 labels Sep 23, 2023
@LogPRose
Copy link

LogPRose commented Dec 5, 2023

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!

@rudokemper rudokemper linked a pull request Dec 6, 2023 that will close this issue
@rudokemper rudokemper linked a pull request Dec 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner friendly Good for newcomers Hacktoberfest Hacktoberfest 2023 rails
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants