Skip to content

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

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

Merged
merged 3 commits into from
Nov 18, 2024

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.

@jeremystretch
Copy link
Member Author

  • 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
  • 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

This all seems to work as expected. (You might need to force a refresh of the JS.)

Peek 2024-11-18 09-25

@jeremystretch jeremystretch merged commit b4f1509 into feature Nov 18, 2024
6 checks passed
@jeremystretch jeremystretch deleted the 5858-quick-add branch November 18, 2024 19:45
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants