-
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix traversing to widgets nested in an object widget #30
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
Conversation
|
@ale-rt thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment: To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
|
@jenkins-plone-org please run jobs |
|
I found some issue while working on https://github.com/collective/collective.z3cform.captionedrelationfield, which has a relation field inside an object field. The issues are fixed by: |
mauritsvanrees
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems something is still wrong. Using the multi field does not work, see also plone/plone.app.content#304 (review)
No content is visible while browsing for a related item. And the network tab shows a few 404s because @@getSource is called on a context that is not found:
|
I directly visit http://localhost:8080/oira/sdaffsdasd/@@edit/++widget++form.widgets.ICaptionRelationBehavior.multi.0.widgets.caption in the browser. While traversing, the target first is: Then: Then it tries to traverse to 0, but this gives an IndexError, which is changed into a Not sure where to go from there. |
|
The main issue with the widget is that it tries to do ajax calls on a URL which looks like:
With $N being the subwidget. Initially, the form field looks like this: So it has no subwidget and you get the error. Inspecting what "Add" does, I noticed the following parameters are submitted: They cause one more widget to be added to the list of the existing ones. So, if you pass these parameters as well, you can properly traverse to the widget: I have no idea if it is worth pushing this PR further for the moment. |
|
I actually checked how the multiwidget works and found a simple fix for that. |
Solves the use case of traversing a new widget that is not initialized by default. This mimics what happens when you click the add button.
|
@jenkins-plone-org please run jobs |
|
@jenkins-plone-org please run jobs |
mauritsvanrees
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested again, and now it works. Thanks!

Fixes #29