ifmeorg / ifme

Free, open source mental health communication web app to share experiences with loved ones
http://www.if-me.org/
GNU Affero General Public License v3.0
1.49k stars 744 forks source link

WIP: Add the ability to create a new Strategy or Moment from an individual Category page #2330

Open lenikadali opened 1 month ago

lenikadali commented 1 month ago

Description

Adds the ability to create a new Strategy or Moment from an individual Category page.

Corresponding Issue

2300

welcome[bot] commented 1 month ago

Thank you for opening this pull request with us! Be sure to follow our Pull Request Practices. Let us know if you have any questions on Slack.

julianguyen commented 4 weeks ago

Hey @lenikadali do you need any help here?

lenikadali commented 4 weeks ago

Hey @lenikadali do you need any help here?

Hi 👋🏿

Thanks for checking in here 🙌🏿 The plan is to try out your suggestions either today or tomorrow and see how it goes 🤞🏿

lenikadali commented 4 weeks ago

So the view is being rendered https://github.com/ifmeorg/ifme/blob/main/app/views/categories/new.html.erb. So you’ll want to do it in the form that is being rendered with React. So you’ll need to update the value of new_category_props on the Rails side. I've attempted to do that in this commit 8b9f8e2

You’ll want to do something like the Moments form where you can add a new Strategy from in there. This isn’t about adding a link to the index page.

Oh. Then what did this statement mean in the issue description 🤔?

Desired Behavior

  1. Go to the https://www.if-me.org/categories/category-name-slug page
  2. Add two buttons "New Moment" and "New Strategy" aligned right of the Category name heading

Also, I noticed that the documentation for the version used of React on Rails is now not easily accessible. Maybe it could be worth it to first upgrade React on Rails as per this ticket and then attempt this one since it would be easier to reference the documentation as we work on this.

julianguyen commented 3 weeks ago

Ohhh sorry I think I misunderstood / forgot about this ticket was asking for even though I wrote it haha.

Yes so what you want to do is modify the form for the show.html.erb page. When you click "New Moment" or "New Strategy" it will automatically have that category pre-checked in their respective new.html.erb forms.

julianguyen commented 3 weeks ago

Yeah, we should upgrade React on Rails! It doesn't block this work, but I agree! There's a ticket to do that already with the latest version of React. https://github.com/ifmeorg/ifme/issues/2115