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