Skip to content

Commit

Permalink
Fix: #5062 - don't close modals when clicking on the backdrop
Browse files Browse the repository at this point in the history
fisharebest committed Dec 1, 2024
1 parent 14de652 commit 84df132
Showing 20 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion app/Elements/XrefLocation.php
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ public function edit(string $id, string $name, string $value, Tree $tree): strin

return
'<div class="input-group">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateLocationModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a location') . '">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateLocationModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a location') . '">' .
view('icons/add') .
'</button>' .
$select .
2 changes: 1 addition & 1 deletion app/Elements/XrefMedia.php
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ public function edit(string $id, string $name, string $value, Tree $tree): strin

return
'<div class="input-group">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateMediaObjectModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a media object') . '">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateMediaObjectModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a media object') . '">' .
view('icons/add') .
'</button>' .
$select .
2 changes: 1 addition & 1 deletion app/Elements/XrefNote.php
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ public function edit(string $id, string $name, string $value, Tree $tree): strin

return
'<div class="input-group">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateNoteModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a shared note') . '">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateNoteModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a shared note') . '">' .
view('icons/add') .
'</button>' .
$select .
2 changes: 1 addition & 1 deletion app/Elements/XrefRepository.php
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ public function edit(string $id, string $name, string $value, Tree $tree): strin

return
'<div class="input-group">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateRepositoryModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a repository') . '">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateRepositoryModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a repository') . '">' .
view('icons/add') .
'</button>' .
$select .
2 changes: 1 addition & 1 deletion app/Elements/XrefSharedNote.php
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ public function edit(string $id, string $name, string $value, Tree $tree): strin

return
'<div class="input-group">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateNoteModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a shared note') . '">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateNoteModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a shared note') . '">' .
view('icons/add') .
'</button>' .
$select .
2 changes: 1 addition & 1 deletion app/Elements/XrefSource.php
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ public function edit(string $id, string $name, string $value, Tree $tree): strin

return
'<div class="input-group">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateSourceModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a source') . '">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateSourceModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a source') . '">' .
view('icons/add') .
'</button>' .
$select .
2 changes: 1 addition & 1 deletion app/Elements/XrefSubmission.php
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ public function edit(string $id, string $name, string $value, Tree $tree): strin

return
'<div class="input-group">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateSubmissionModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a submission') . '">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateSubmissionModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a submission') . '">' .
view('icons/add') .
'</button>' .
$select .
2 changes: 1 addition & 1 deletion app/Elements/XrefSubmitter.php
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ public function edit(string $id, string $name, string $value, Tree $tree): strin

return
'<div class="input-group">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateSubmitterModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a submitter') . '">' .
'<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="' . e(route(CreateSubmitterModal::class, ['tree' => $tree->name()])) . '" data-wt-select-id="' . $id . '" title="' . I18N::translate('Create a submitter') . '">' .
view('icons/add') .
'</button>' .
$select .
2 changes: 1 addition & 1 deletion app/Http/RequestHandlers/DataFixData.php
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
] + $params);

// wt-ajax-modal-title
$col2 = '<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="' . $preview_url . '">' . view('icons/search') . I18N::translate('Preview') . '</button>';
$col2 = '<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="' . $preview_url . '">' . view('icons/search') . I18N::translate('Preview') . '</button>';
$col2 .= ' <button type="button" class="btn btn-primary" data-update-url="' . $update_url . '">' . view('icons/data-fix') . I18N::translate('Update') . '</button>';
} else {
$col2 = '';
2 changes: 1 addition & 1 deletion app/Http/RequestHandlers/ManageMediaData.php
Original file line number Diff line number Diff line change
@@ -248,7 +248,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
if (str_starts_with($row[0], $media_directory)) {
$tmp = substr($row[0], strlen($media_directory));
$create_form .=
'<p><a href="#" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#modal-create-media-from-file" data-file="' . e($tmp) . '" data-url="' . e(route(CreateMediaObjectFromFile::class, ['tree' => $media_tree])) . '" onclick="document.getElementById(\'modal-create-media-from-file-form\').action=this.dataset.url; document.getElementById(\'file\').value=this.dataset.file;">' . I18N::translate('Create') . '</a> — ' . e($media_tree) . '<p>';
'<p><a href="#" data-bs-toggle="modal" data-bs-target="#modal-create-media-from-file" data-file="' . e($tmp) . '" data-url="' . e(route(CreateMediaObjectFromFile::class, ['tree' => $media_tree])) . '" onclick="document.getElementById(\'modal-create-media-from-file-form\').action=this.dataset.url; document.getElementById(\'file\').value=this.dataset.file;">' . I18N::translate('Create') . '</a> — ' . e($media_tree) . '<p>';
}
}

5 changes: 2 additions & 3 deletions resources/views/admin/components.phtml
Original file line number Diff line number Diff line change
@@ -97,8 +97,7 @@ use Illuminate\Support\Collection;
<?php endforeach ?>
</ul>

<div class="modal fade" id="access-level-<?= $module->name() ?>" tabindex="-1"
role="dialog">
<div class="modal fade" data-bs-backdrop="static" tabindex="-1" role="dialog" aria-hidden="true" id="access-level-<?= $module->name() ?>">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@@ -135,7 +134,7 @@ use Illuminate\Support\Collection;
</td>

<td>
<button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-backdrop="static"
<button type="button" class="btn btn-link" data-bs-toggle="modal"
data-bs-target="#access-level-<?= $module->name() ?>">
<?= view('icons/edit') ?>
<span class="visually-hidden"><?= I18N::translate('edit') ?></span>
2 changes: 1 addition & 1 deletion resources/views/admin/data-fix-page.phtml
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ use Fisharebest\Webtrees\View;

<hr>

<a href="#" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="<?= e(route(HelpText::class, ['topic' => 'data-fixes'])) ?>">
<a href="#" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="<?= e(route(HelpText::class, ['topic' => 'data-fixes'])) ?>">
<?= view('icons/help') ?>
<?= I18N::translate('Why does this list include records that do not need to be updated?') ?>
</a>
10 changes: 5 additions & 5 deletions resources/views/admin/trees.phtml
Original file line number Diff line number Diff line change
@@ -230,23 +230,23 @@ use Fisharebest\Webtrees\View;
<!-- UNLINKED SOURCE -->
<li>
<span class="fa-li"><?= view('icons/source') ?></span>
<a href="#" data-wt-href="<?= e(route(CreateSourceModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static">
<a href="#" data-wt-href="<?= e(route(CreateSourceModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal">
<?= I18N::translate('Source') ?>
<span class="visually-hidden"><?= e($managed_tree->title()) ?></span>
</a>
</li>
<!-- UNLINKED REPOSITORY -->
<li>
<span class="fa-li"><?= view('icons/repository') ?></span>
<a href="#" data-wt-href="<?= e(route(CreateRepositoryModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static">
<a href="#" data-wt-href="<?= e(route(CreateRepositoryModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal">
<?= I18N::translate('Repository') ?>
<span class="visually-hidden"><?= e($managed_tree->title()) ?></span>
</a>
</li>
<!-- UNLINKED MEDIA OBJECT -->
<li>
<span class="fa-li"><?= view('icons/media') ?></span>
<a href="#" data-wt-href="<?= e(route(CreateMediaObjectModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static">
<a href="#" data-wt-href="<?= e(route(CreateMediaObjectModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal">

<?= I18N::translate('Media object') ?>
<span class="visually-hidden"><?= e($managed_tree->title()) ?></span>
@@ -255,15 +255,15 @@ use Fisharebest\Webtrees\View;
<!-- UNLINKED NOTE -->
<li>
<span class="fa-li"><?= view('icons/note') ?></span>
<a href="#" data-wt-href="<?= e(route(CreateNoteModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static">
<a href="#" data-wt-href="<?= e(route(CreateNoteModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal">
<?= I18N::translate('Shared note') ?>
<span class="visually-hidden"><?= e($managed_tree->title()) ?></span>
</a>
</li>
<!-- UNLINKED SUBMITTER -->
<li>
<span class="fa-li"><?= view('icons/submitter') ?></span>
<a href="#" data-wt-href="<?= e(route(CreateSubmitterModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static">
<a href="#" data-wt-href="<?= e(route(CreateSubmitterModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal">
<?= I18N::translate('Submitter') ?>
<span class="visually-hidden"><?= e($managed_tree->title()) ?></span>
</a>
2 changes: 1 addition & 1 deletion resources/views/help/link.phtml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ use Fisharebest\Webtrees\I18N;
*/

?>
<a href="#" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="<?= e(route(HelpText::class, ['topic' => $topic])) ?>" title="<?= I18N::translate('Help') ?>">
<a href="#" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="<?= e(route(HelpText::class, ['topic' => $topic])) ?>" title="<?= I18N::translate('Help') ?>">
<?= view('icons/help') ?>
<span class="visually-hidden"><?= I18N::translate('Help') ?></span>
</a>
2 changes: 1 addition & 1 deletion resources/views/media-page-details.phtml
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ use Illuminate\Support\Collection;
<?= I18N::translate('Media file') ?>
<?php if ($record->canEdit() && !$media_file->isPendingDeletion()) : ?>
<div class="pt-2 wt-fact-edit-links">
<a class="btn btn-link" href="#" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#wt-ajax-modal" data-wt-href="<?= route(EditMediaFileModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact_id' => $media_file->factId()]) ?>" title="<?= I18N::translate('Edit') ?>">
<a class="btn btn-link" href="#" data-bs-toggle="modal" data-bs-target="#wt-ajax-modal" data-wt-href="<?= route(EditMediaFileModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact_id' => $media_file->factId()]) ?>" title="<?= I18N::translate('Edit') ?>">
<?= view('icons/edit') ?>
<span class="visually-hidden">
<?= I18N::translate('Edit') ?>
8 changes: 4 additions & 4 deletions resources/views/media-page-menu.phtml
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ use Illuminate\Support\Collection;
</button>

<div class="dropdown-menu dropdown-menu-end wt-page-menu-items" aria-labelledby="page-menu">
<a class="dropdown-item" href="#" data-wt-href="<?= e(route(AddMediaFileModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static">
<a class="dropdown-item" href="#" data-wt-href="<?= e(route(AddMediaFileModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal">
<?= view('icons/add') ?>
<?= I18N::translate('Add a media file') ?>
</a>
@@ -55,17 +55,17 @@ use Illuminate\Support\Collection;

<div class="dropdown-divider"></div>

<a class="dropdown-item" href="#" data-wt-href="<?= e(route(LinkMediaToIndividualModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static">
<a class="dropdown-item" href="#" data-wt-href="<?= e(route(LinkMediaToIndividualModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal">
<?= view('icons/link') ?>
<?= I18N::translate('Link this media object to an individual') ?>
</a>

<a class="dropdown-item" href="#" data-wt-href="<?= e(route(LinkMediaToFamilyModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static">
<a class="dropdown-item" href="#" data-wt-href="<?= e(route(LinkMediaToFamilyModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal">
<?= view('icons/link') ?>
<?= I18N::translate('Link this media object to a family') ?>
</a>

<a class="dropdown-item" href="#" data-wt-href="<?= e(route(LinkMediaToSourceModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static">
<a class="dropdown-item" href="#" data-wt-href="<?= e(route(LinkMediaToSourceModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal">
<?= view('icons/link') ?>
<?= I18N::translate('Link this media object to a source') ?>
</a>
2 changes: 1 addition & 1 deletion resources/views/modals/ajax.phtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- A dynamic modal, with content loaded using AJAX. -->
<div class="modal fade" id="wt-ajax-modal" tabindex="-1" role="dialog" aria-labelledBy="wt-ajax-modal-title" aria-hidden="true">
<div class="modal fade" data-bs-backdrop="static" tabindex="-1" role="dialog" aria-hidden="true" id="wt-ajax-modal" aria-labelledBy="wt-ajax-modal-title">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div id="wt-ajax-modal-title"></div>
2 changes: 1 addition & 1 deletion resources/views/modals/create-media-from-file.phtml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ use Fisharebest\Webtrees\I18N;
*/
?>

<div class="modal" id="modal-create-media-from-file">
<div class="modal fade" data-bs-backdrop="static" tabindex="-1" role="dialog" aria-hidden="true" id="modal-create-media-from-file">
<form method="post" action="<?= e(route(CreateMediaObjectFromFile::class)) ?>" id="modal-create-media-from-file-form">
<input type="hidden" name="action" value="create-media-object-from-file">
<input type="hidden" name="tree" id="tree" value="">
2 changes: 1 addition & 1 deletion resources/views/modals/shares.phtml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ use Illuminate\Support\Collection;
*/

?>
<div class="modal fade" id="wt-shares-modal" tabindex="-1" role="dialog" aria-label="<?= e($title) ?>" aria-hidden="true">
<div class="modal fade" data-bs-backdrop="static" tabindex="-1" role="dialog" aria-hidden="true" id="wt-shares-modal" aria-label="<?= e($title) ?>">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<?= view('modals/header', ['title' => $title]) ?>
4 changes: 2 additions & 2 deletions resources/views/modules/favorites/favorites.phtml
Original file line number Diff line number Diff line change
@@ -43,11 +43,11 @@ use Illuminate\Support\Collection;
<?php endforeach ?>

<?php if ($can_edit) : ?>
<button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#favorite-form-<?= e($block_id) ?>">
<button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#favorite-form-<?= e($block_id) ?>">
<?= I18N::translate('Add a favorite') ?>
</button>

<div class="modal fade" id="favorite-form-<?= e($block_id) ?>" tabindex="-1" role="dialog" aria-labelledby="favorite-form-<?= e($block_id) ?>-label" aria-hidden="true">
<div class="modal fade" data-bs-backdrop="static" tabindex="-1" role="dialog" aria-hidden="true" id="favorite-form-<?= e($block_id) ?>" aria-labelledby="favorite-form-<?= e($block_id) ?>-label">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<form method="post" action="<?= e(route('module', ['module' => $module_name, 'action' => 'AddFavorite', 'tree' => $tree->name()])) ?>">

0 comments on commit 84df132

Please sign in to comment.