-
-
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
3.21.0 introduced a bug with testing view components.
5e2c4da
to
909607d
Compare
909607d
to
184c645
Compare
If a table has no rowUrl defined we currently redirect to root path. Which is not preferable. We should do nothing instead.
We do not want to render the whole layout if the request is a turbo frame request. We just want to render the component's html.
354c7c2
to
a1e9278
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6046 +/- ##
==========================================
+ Coverage 87.82% 89.59% +1.77%
==========================================
Files 477 791 +314
Lines 11670 18242 +6572
==========================================
+ Hits 10249 16344 +6095
- Misses 1421 1898 +477 ☔ View full report in Codecov by Sentry. |
This is actual links to open the new and edit forms in the modal dialog remotely.
a1e9278
to
162d93c
Compare
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 |
href: solidus_admin.new_adjustment_reason_path, data: { turbo_frame: :new_adjustment_reason_modal }, | ||
href: solidus_admin.new_adjustment_reason_path, data: { | ||
turbo_frame: :new_adjustment_reason_modal, | ||
turbo_prefetch: false |
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.
btw we probably can turn turbo-prefetch
off globally with meta tag
<meta name="turbo-prefetch" content="false">
I can see prefetching is done on almost all the links, but the problem with it is that prefetch is done on each and every hover on the same link, i.e you hover five times over one link and it makes five requests to the same endpoint. It's not really useful without caching and if i'm not mistaken there's no caching set up (but please correct me if i'm wrong!)
@@ -137,11 +137,12 @@ | |||
<%= "data-sortable-animation-value=#{@sortable.animation}" if @sortable&.animation %> | |||
> | |||
<% @data.rows.each do |row| %> | |||
<% rowUrl = @data.url&.call(row) %> |
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.
row_url
snake case 😉
09dddb7
to
3776427
Compare
3776427
to
6b476d4
Compare
Depends on #6048
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: