openfoodnetwork icon indicating copy to clipboard operation
openfoodnetwork copied to clipboard

[BUU] Remove StimulusReflex from Image Edit

Open dacook opened this issue 9 months ago • 0 comments

What? Why?

Because I have had quite enough of StimulusReflex.

  • Closes #12399

Although I have to admit I'm not entirely impressed by Turbo either. I was hoping to also implement dynamic reloading of the new image in-place (rather than reloading the whole page), but had some limitations:

  • Turbo Frame: It would require a bit of a weird setup with a few partials and I think it will be a bit hard for a newcomer to understand (defeating the purpose of using frames I think).
  • Turbo Streams: Almost got it, but for some reason the form wasn't submitting for turbo streams.

So I think the next step would be to either try harder with Turbo, or just write a Stimulus Controller to do what we want.

FYI for reviewers, there's already a system spec, and it continues to just work :D

What should we test?

/admin/products with admin_Style_v3 enabled

For each of:

  • product with an image.
  • product with the default image (ofn logo).
  • With any url params like ?page=2 (note that you might have to add these manually, due to https://github.com/openfoodfoundation/openfoodnetwork/issues/11640)
  1. Click on the image, view the modal. Close the modal.
  2. Click on the image again, upload a new one
  3. Image should be updated, with success message. You should land on the right page too.

dacook avatar May 22 '24 07:05 dacook