entdec / satis

Satis allow you to focus on features, let us do the UI/UX. You'll be satisfied!
MIT License
0 stars 0 forks source link

[feature] Make Attachments a Satis Component rather then rendering and adding partials to every view that uses this #174

Open TwistedClone opened 2 months ago

TwistedClone commented 2 months ago

image

We currently do it this way: = render partial: 'products/attachments/index', locals: { attachments: @product.images, upload_url: product_attachments_path(@product) }

By calling on the _attachments.html.slim partial within model folders

We should make it a method as = sts.attachments(@product)

TwistedClone commented 2 months ago

Related PRs: Satis: https://github.com/entdec/satis/pull/172 Nuntius: https://github.com/entdec/nuntius/pull/23 Papyrus: https://github.com/entdec/papyrus/pull/36

We can now pass = sts.attachments(@model) from components and main app

Overall current look: image Dark mode: image

I was able to add the show method that now downloads the files correctly

I'm still facing one issue and that is on the delete method. I added the upload_url variable to the initialize method that can be passed, so we can for example pass "admin_layout_attachments_path" and use it in the view for a destroy function, however we currently use rails/active_storage/blobs directly for the destroy method, we should call it on the path instead otherwise we're just trying to destroy the blob but not the attachment.

But when i did it would throw errors saying that it was looking for the destroy method in Nuntius::Layout::Satis::AttachmentsController (something like that) We should skip looking for the engine itself and always use the satis attachments controller.

Also the uploading icon just keeps spinning, seems we're missing some javascript that i was supposed to bring along from server to satis however i don't see that existing in server, something like an attachments_controller.js, i dont see a reference to the icon classes either