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