-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Admin] Confirmation modal #6295
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
base: main
Are you sure you want to change the base?
Conversation
e8a5321
to
e0ab3ca
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6295 +/- ##
=======================================
Coverage 88.97% 88.98%
=======================================
Files 861 862 +1
Lines 18416 18422 +6
=======================================
+ Hits 16386 16392 +6
Misses 2030 2030 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e0ab3ca
to
d2d5a3c
Compare
d2d5a3c
to
d54d00a
Compare
* adds possibility to conditionally open modal on connect - use stimulus value instead of Dialog's "open" attribute (applying attribute directly on dialog element is discouraged by HTML specification https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/open#value); * adds identifier classes to title ".modal-title" and body ".modal-body" so that turbo-confirm can target them correctly; * adds "empty:hidden" so that when no content is passed the empty div does not take space in the modal;
4060de4
to
c20f8dc
Compare
Updates several components to use "data-turbo-confirm" and new confirmation dialog instead of native browser confirm. Removes redundant confirm_controller.js.
Default animation duration was 300ms. It controls how long turbo-control will wait before restoring default confirm modal content (empty template). Due to that there could be a condition if you click fast enough when requesting a different confirm dialog, e.g. in products table clicking "Delete", closing modal and then clicking "Deactivate", then modal contents would be overwritten with previous modal contents. Since we don't use any kind of animation for modals we can put 0 duration to mitigate that bug.
c20f8dc
to
28d04f0
Compare
This has a conflict that needs addressing. |
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.
I would love to not use an external gem for a simple task as adding a function that opens a Dialog on data-turbo-confirm https://turbo.hotwired.dev/reference/drive#turbo.config.forms.confirm
We already have a Dialog handler that we use to open dialogs. We should use that instead of an external library that very likely will stop receiving updates in a few months.
For the time being we can continue to use the native confirm that Turbo is using. No user will see a difference anyway. Maybe there area some relevant changes in this 10 commits PR that we can extract.. |
Summary
Using turbo-confirm add-on create a UI confirmation modal component to use Turbo-native "data-turbo-confirm" functionality along with custom modal dialog, rather than browser native confirm dialog.
Screenshots
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs: