Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NovaDependencyContainer #26

Open
Fabio1988 opened this issue Dec 10, 2018 · 7 comments
Open

NovaDependencyContainer #26

Fabio1988 opened this issue Dec 10, 2018 · 7 comments

Comments

@Fabio1988
Copy link

Fabio1988 commented Dec 10, 2018

Unfortunately it's not working with the package NovaDependencyContainer.

I use that dependency-container to show certain attributes, when something is selected in the form. But when I use NestedForms and I select something in the select-box, nothing happens.

Is there a workaround? Would be great to use both in the same Nova model.

@sabid
Copy link

sabid commented Mar 4, 2019

@yassipad What could be causing this package not work with:

https://github.com/dillingham/nova-ajax-select

https://github.com/orlyapps/nova-belongsto-depend

@yassilah
Copy link
Owner

yassilah commented Mar 5, 2019

I'm guessing both are using the "attribute" value of each field, which needs to be changed for this package to work; you would have have several times the same attribute otherwise.

Example:

If a User has Posts, instead of having the default attributes ('name', 'email', 'content', 'title', 'content', 'title'), I need to transform them into nested attributes ('name', 'email', 'posts[0][title]', 'posts[0][content]', 'posts[1][title]','posts[1][content]').

@nickpoulos
Copy link

Yes, it seems there are a handful of very useful field packages that many people use, that throw monkey wrenches into others. Like yassipad guessed, this is almost certainly due to the way these fields are using the attribute field.

You will see fields like epartment/dependency-container, dillingham/nova-ajax-select, and 64robots/json have issues. Ex. I had to modify 64robots/json to specifically look for dependency-container fields and handle one extra level of depth. Seems to be a similar issue here, as well as others.

Sure you could go one more level deep with the attribute abstraction, but seems like it would be hard to find the line to draw, at exactly how far deep to go.

Maybe as a way to fix some of this, Nova should adopt several more fields into their core. It would still require other fields depending on attribute (like this one) to have to check for field types, but at least they would be standard field types with standard names, and not the random name of a 3rd party one the dev decided on. Or even a trait called usesAttributes that could be checked for with instanceof or something. Just a thought.

@g0shed
Copy link

g0shed commented May 17, 2019

if anyone is interested, this is a 'fix' for https://github.com/orlyapps/nova-belongsto-depend

orlyapps/nova-belongsto-depend#39

it works on both a nested form or directly in the resource

@alberto-bottarini
Copy link
Collaborator

alberto-bottarini commented Oct 5, 2020

@Fabio1988
I created a fork of nova-dependecy-container.
Here you can find a container version that works inside a nested form.
https://github.com/alberto-bottarini/nova-dependency-container

Could you please help me in testing? If everything works, I will do a PR.

container-nested

@alberto-bottarini
Copy link
Collaborator

Please upvote my PR
epartment/nova-dependency-container#146

@smskin
Copy link

smskin commented Jan 12, 2022

I fixed conflicts in the new PR. Please upvote. epartment/nova-dependency-container#202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants