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

Closes #5858: Implement a quick-add UI widget for related objects #18016

Open
wants to merge 2 commits into
base: feature
Choose a base branch
from

Conversation

jeremystretch
Copy link
Member

@jeremystretch jeremystretch commented Nov 14, 2024

Closes: #5858

  • Extend the APISelect widget to support a "quick add" button, which launches an embedded modal
  • Extend ObjectEditView to support a new "quick add" workflow (designated by the _quickadd=True URL query parameter)
  • Adapt initReslug() to accommodate multiple "reslug" buttons on the page
  • Add quick_add=True to various form fields as appropriate

Peek 2024-11-13 14-57

@jeremystretch jeremystretch marked this pull request as ready for review November 14, 2024 19:14
@jeremystretch
Copy link
Member Author

There's still a bug involving the quick selector widget when displayed within the quick add form. For instance, opening the power feed form, clicking the "quick add" button for power panel, and then clicking the selector button next to the site field will close the model. This is because the selector button toggles the currently open modal, closing it.

Unfortunately, Bootstrap doesn't provide a mechanism for explicitly displaying a modal via an HTML data attribute. We can introduce an event listener for this, however that seems to complicate the logic for dismissing modals as well. Need to dig into this a bit more; not sure it's worth holding up the whole PR for it.

@jeremystretch jeremystretch added this to the v4.2 milestone Nov 14, 2024
@arthanson
Copy link
Collaborator

arthanson commented Nov 15, 2024

  • slug fields don't auto-populate if there is a slug field also on the launching form.
  • regenerate slug (spinner to the right of slug field) regenerates based on original form, not modal form name.
  • It would also be nice to have the quick-added field auto-selected when you create it in the form that you launched it from - that is what I would expect to happen. Here you quick add it, then need to select it.

@@ -66,6 +66,7 @@ class DynamicModelChoiceMixin:
choice (DEPRECATED: pass `context={'disabled': '$fieldname'}` instead)
context: A mapping of <option> template variables to their API data keys (optional; see below)
selector: Include an advanced object selection widget to assist the user in identifying the desired object
quick_add: Include a widget to quickly create a new related object for assignment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment do not set it if the folllow-on form has any quick add fields.

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

Successfully merging this pull request may close these issues.

2 participants