[Admin] Open modal content remotely#6044
Closed
tvdeyen wants to merge 6 commits intosolidusio:mainfrom
Closed
Conversation
This allows to run prettier in your editor
Adjust the syntax of all admin js files to prettier config.
This controller provides a openModal action that we can use to load the modal remotely instead of returning the whole index page with the table rendered below the modal. Currently no page uses this, but it can be implemented page by page.
This removes the dialog element from the dom after closing it. Combined with the new pages index controller we can open and close modals without leaving the page. Much faster and less round trips.
If a table has no rowUrl defined we currently redirect to root path. Which is not preferable. We should do nothing instead.
This is actual links to open the new and edit forms in the modal dialog remotely.
Member
Author
|
@MadelineCollier I finally cracked it. I think the code is pretty much self-explanatory. I would like us to migrate all existing admin index pages to follow this pattern and only use this going forward. We will be able to remove even more code from the components if we are done with the migration. Merry Christmas 🎄 |
Contributor
Member
Author
Member
Author
|
Closing in favor of #6045 |
Member
Author
|
Will rework the Shipping Category changes on top of #6045 once this is merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needs #6043
Summary
Part of #5944
This adds a new Stimulus controller and action to the admin pages index component.
Links that have the
click->ui--pages--index#openModaldata-actionnow open thecontent returned by the Rails controller remotely inside the modal. This works by disabling
the layout while rendering the action from the controller and nesting the turbo-frame
inside of the dialog component.
This removes the necessity to re-render the pages index component on the new and edit actions and
with that it reduces DB queries and the need to maintain the url params across actions.
As first page I migrated the Shipping Category page. Other pages will follow in sub-sequent PRs
Overall this uses less code and is more intuitive by leveraging what Rails., Stimulus and Turbo provides
us with.
"Let's delete some Dead Code"
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: