Terrastories / terrastories

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

[Rails][Administrate] Add ability to upload/include a custom logo in Themes #505

Closed mirandawang closed 3 years ago

mirandawang commented 4 years ago

Since the terrastories app can be used by more than just one community, we would like it to be flexible and customizable through our concept of Themes.

There is a Theme model which exists and currently can change visual elements of the app, as well as some logic to make sure only one Theme is active at a time.

For this issue, let’s extend the model so you can also upload a custom logo. This should show up under the box on the Welcome page here: Screen Shot 2020-09-03 at 5 35 36 PM

You can find the code here: https://github.com/Terrastories/terrastories/blob/master/rails/app/views/welcome/index.html.erb#L30

Users should be able to add a custom logo to a Theme in the admin panel via uploading through ActiveStorage. You can look at the Place or Story model as an example as to how we use ActiveStorage to attach images.

To login to the admin panel, you can use the default terrastories admin account which is set up in the seeds.rb file.

We should also add some validations to make sure that this field can only take image format uploads.

Acceptance Criteria: Theme can be created/edited with a logo field in the admin panel The active theme’s logo appears on the Welcome page underneath the box. If a user uploads a file that is not an image, show an error on the admin page.

Bonus points: Add unit tests

tauhir commented 3 years ago

Can I pick this up? I've submitted a PR for #506 and this is quite similar.

mirandawang commented 3 years ago

Hi @tauhir that would be great! And will review your PR ASAP :)