Hey guys! Really digging Avo, trying to build out ...
# avo-2
t
Hey guys! Really digging Avo, trying to build out the basic needs for our backoffice in it now. One thing I would like to ask/have clarified before I start to build it: I have an
Invoice
resource with
has_many :line_items
how would I go about having this on -one-
edit
view in Avo? It seems this is not default supported but I'd like to build a workaround for it. Do I need to resort to a custom field to edit these? Or is there another workaround to get this?
l
If you need it to the
edit
view, add
show_on: :edit
to the
has_many
field
that will not work on
create
though
that's because the current way of creating & attaching associated items needs the parent model (
invoice
in your case) to be created
t
Thanks, I've tried that, but then it just shows the "show" view on the edit page, no way to edit those fields.
l
oh, you mean inline editing for the
Index
view?
t
Yes, f.e. I'm on the edit view of an Invoice, there's a section "line items" where I can edit those too (or add a new line item/delete one)
now it just lists them there like an Index view
l
that's the correct behaviour. you then, can click on
edit
on each one and edit them in their own place
t
I think what I need is the same as this issue: https://github.com/avo-hq/avo/issues/974 but since that's pending/not built yet, I'm wondering what the best way to go at it would be
l
the inline editing mechanism isn't release yet
the best way to show us is to create a GitHub issue with a screen recording or screenshot from somewhere else you've seen that pattern
t
Yes that's clear 🙂 it's just not doable to click open every line item and edit it on their own if you need to toggle a boolean f.e.
l
I undertand that
for that case, you can create an action named toggle published, select the record and use that action on there
it's still not the best experience btu we're working on improving it
t
Thanks, I understand it's just one thing on Avo's roadmap 🙂 just trying to think of hacky ways to make it work with the current codebase haha
l
that's a related PR that enables the develoer to customize the controls on the show page
we'll add that to the table row too
inline editing is incoming too
t
I'll try to make it work with the action and await the inline editing 🙂
l
the quickest way of doing that is to add a PR to Avo
we'll even help with navigating the codebase
t
Yes, I think a bit like Cocoon
I'll explore the options in the current codebase! It's clear enough, so no help needed there (compliment ;))
l
to keep track of