xref: /webtrees/resources/views/media-page-menu.phtml (revision 184b4ea444b4888a94f428f84612c128057df819)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\Http\RequestHandlers\AddMediaFileModal;
5use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
6use Fisharebest\Webtrees\Http\RequestHandlers\EditRecordPage;
7use Fisharebest\Webtrees\Http\RequestHandlers\LinkMediaToFamilyModal;
8use Fisharebest\Webtrees\Http\RequestHandlers\LinkMediaToIndividualModal;
9use Fisharebest\Webtrees\Http\RequestHandlers\LinkMediaToSourceModal;
10use Fisharebest\Webtrees\I18N;
11use Fisharebest\Webtrees\Media;
12use Illuminate\Support\Collection;
13
14/**
15 * @var Collection<Fact> $clipboard_facts
16 * @var Media            $record
17 */
18
19?>
20
21<div class="dropdown wt-page-menu">
22    <button class="btn btn-primary dropdown-toggle wt-page-menu-button" type="button" id="page-menu" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
23        <?= view('icons/menu') ?>
24        <?= I18N::translate('edit') ?>
25    </button>
26
27    <div class="dropdown-menu dropdown-menu-end wt-page-menu-items" aria-labelledby="page-menu">
28        <!--
29        <a class="dropdown-item" href="<?= route(EditRecordPage::class, ['xref' => $record->xref(), 'tree' => $record->tree()->name()]) ?>">
30            <?= view('icons/edit') ?>
31            <?= I18N::translate('Edit') ?>
32        </a>
33        -->
34
35        <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">
36            <?= view('icons/add') ?>
37            <?= I18N::translate('Add a media file') ?>
38        </a>
39
40        <?php if ($record->missingFacts() !== []) : ?>
41            <div class="dropdown-divider"></div>
42
43            <?= view('record-page-menu-facts', ['record' => $record]) ?>
44        <?php endif ?>
45
46        <?php if ($clipboard_facts->isNotEmpty()) : ?>
47            <div class="dropdown-divider"></div>
48
49            <?= view('record-page-menu-clipboard', ['clipboard_facts' => $clipboard_facts, 'record' => $record]) ?>
50        <?php endif ?>
51
52        <div class="dropdown-divider"></div>
53
54        <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">
55            <?= view('icons/link') ?>
56            <?= I18N::translate('Link this media object to an individual') ?>
57        </a>
58
59        <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">
60            <?= view('icons/link') ?>
61            <?= I18N::translate('Link this media object to a family') ?>
62        </a>
63
64        <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">
65            <?= view('icons/link') ?>
66            <?= I18N::translate('Link this media object to a source') ?>
67        </a>
68
69        <div class="dropdown-divider"></div>
70
71        <a class="dropdown-item" href="#" data-wt-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->fullName())) ?>" data-wt-post-url="<?= e(route(DeleteRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
72            <?= view('icons/delete') ?>
73            <?= I18N::translate('Delete') ?>
74        </a>
75    </div>
76</div>
77