You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For my implementation, I've done some very basic customisation, to allow for a Modal to optionally "confirm before close" regardless of if it's dirty or not.
While you can of course do the documented implementation below, or something similar (for ensuring it always confirms), it felt a bit like it should be part of the core package.
@script
<script>
$wire.on('closingModalOnEscape', data => {
if ($wire.isDirty && !confirm('{{ __('You have unsaved changes. Are you sure you want to close this dialog?') }}')) {
data.closing = false;
}
});
$wire.on('closingModalOnClickAway', data => {
if ($wire.isDirty && !confirm('{{ __('You have unsaved changes. Are you sure you want to close this dialog?') }}')) {
data.closing = false;
}
});
</script>
@endscript
I thought it may be useful to be able to define at a Modal level that it should be "confirm before close".
To do this in a slightly customised implementation, I added two new static methods/properties, and added them into the modalProperties array.
Then I just did a check in the "closeModal" js method.
Thoughts on whether this is something that may be wanted? If so - I'll open a PR
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
For my implementation, I've done some very basic customisation, to allow for a Modal to optionally "confirm before close" regardless of if it's dirty or not.
While you can of course do the documented implementation below, or something similar (for ensuring it always confirms), it felt a bit like it should be part of the core package.
I thought it may be useful to be able to define at a Modal level that it should be "confirm before close".
To do this in a slightly customised implementation, I added two new static methods/properties, and added them into the modalProperties array.
Then I just did a check in the "closeModal" js method.
Thoughts on whether this is something that may be wanted? If so - I'll open a PR
Beta Was this translation helpful? Give feedback.
All reactions