Add a InlineBelongsTo field #405
rakso-startkoden
started this conversation in
Ideas
Replies: 1 comment
-
I guess essentially I would like something like this to be possible:
Which I guess would require some kind of mix with code from HasManyThrough to render the child field as correct components? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I was converting my existing admin to using Backpex and I have cases in my apps that i think is quite common and should be considered.
I have a Schema "A" with a belongs_to to schema "B". But I don't want to have a entire live resource for B since its only ever used in association with A. Which means that I usually just have cast_assoc on schema a and use inputs_for for the nested changeset of B while editing A.
From looking in the source this would be a mix between the InlindeCrud, BelongsTo and the HasManyThrough field currently defined in Backpex. It could behave in a very similar manner in the forms as the HasManyThrough with the modal, or simply have them embedded in some kind of nested box inside the form.
I always think that screenshots for context is helpful so here is an example from my current admin where Schema Service has a belongs_to to a schema called Presentation page, which is in a separate schema because its not always needed in the context of services but still unique for a specific service.
![Screenshot from 2024-06-23 15-21-51](https://private-user-images.githubusercontent.com/169435894/342067618-45002a1d-9aa2-4edb-98a6-cb28b13b9d28.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0Mjc3NTUsIm5iZiI6MTczOTQyNzQ1NSwicGF0aCI6Ii8xNjk0MzU4OTQvMzQyMDY3NjE4LTQ1MDAyYTFkLTlhYTItNGVkYi05OGE2LWNiMjhiMTNiOWQyOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxM1QwNjE3MzVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01NDU2Zjk1MWVkYWM4ZjAxZGQwMjc2NzJhMmRkZGJhN2QwMDFjNDIxOGJhOTIzNDAwMDMxYjA1ZmM4NjcxYWM2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.yAY-nL3z2t_P9S-i51VP6kKwmUnjkjfRcmxyX6PNxeU)
I tried making my own based on the existing field modules. And could modify the inlinecrud to not expect a list of assocs but a single one instead, but was unable to get the rendering of field modules and not only text field working properly.
Beta Was this translation helpful? Give feedback.
All reactions