-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Admin] Open edit and new forms in dialog with turbo frame #6046
base: main
Are you sure you want to change the base?
Conversation
22f5345
to
5e2c4da
Compare
5e2c4da
to
909607d
Compare
354c7c2
to
a1e9278
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6046 +/- ##
==========================================
- Coverage 92.52% 89.59% -2.93%
==========================================
Files 385 794 +409
Lines 8400 18262 +9862
==========================================
+ Hits 7772 16362 +8590
- Misses 628 1900 +1272 ☔ View full report in Codecov by Sentry. |
162d93c
to
ca8ae78
Compare
@tvdeyen i've checked out your branch and here's the screen recording of the "issues" i mentioned. You can see when I open the edit page in the new tab and click outside, it makes a request to However, I guess I understood it incorrectly what you meant about being able to visit the edit page. In my PR I have done it in a way that the underlying table is still rendered on edit page which I thought was your goal. Screen.Recording.2024-12-20.at.23.38.25.movThough there's one more thing I discovered, not related to visiting edit page, but opening a modal with "turbo-framed" link and clicking outside: Screen.Recording.2024-12-20.at.23.50.35.movas you can see it makes a request to |
admin/app/components/solidus_admin/adjustment_reasons/index/component.rb
Show resolved
Hide resolved
f566aa1
to
fd5cbe3
Compare
@chaimann Now, I understand what you meant. Thanks for the screen recording. This helps to understand the issue.
Yeah, I think that we do not display the index table on the The same is true for the redirect after successful form submission.
This is how |
3995aa3
to
05dabbd
Compare
97b06a3
to
bc0f636
Compare
c771be0
to
9f5d275
Compare
e02f07f
to
6fa7a4f
Compare
admin/app/components/solidus_admin/adjustment_reasons/index/component.rb
Outdated
Show resolved
Hide resolved
admin/app/components/solidus_admin/adjustment_reasons/index/component.rb
Outdated
Show resolved
Hide resolved
6fa7a4f
to
fba7722
Compare
If a table has no rowUrl defined we currently redirect to root path. Which is not preferable. We should do nothing instead.
34bd4db
to
16066fd
Compare
We do not want to render the whole admin layout if the request is a turbo frame request. We just want to render the component's html in the minimal rails turbo frame layout, which still gives us the option to yield something into the head for ie. cache control.
We don't want to deal with Turbo caching issues in the new admin. The content a customer agent or product administrator should always be the latest and most accurate version. Prefetching is a performance nightmare for an admin interface like ours. Co-authored-by: Eugene Chaikin <[email protected]>
16066fd
to
0f2f8a2
Compare
This controller and components should be used for the Solidus Admin RESTful resource views. It handles Turbo Frame requests from the forms inside the modal dialog and redirects or rerenders via turbo stream accordingly. That way we can use normal links and form submits for our resource views without the need for custom JS.
This tells turbo to reload the page if we redirect from a turbo frame request. No need to respond with a turbo refresh stream.
0f2f8a2
to
ab838cb
Compare
Summary
Opens new and edit forms of Admin resources in dialogs with Turbo Frames.
Removing the need of rendering the index table again on the form components.
Also handles the layout toggle for all turbo frame requests.
Includes the ground work from #6045
Closes #5944
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: