xref: /webtrees/resources/views/media-page-menu.phtml (revision 9313feb86bd19aa44ab31e02409d4e7174be131a)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Fact;
5use Fisharebest\Webtrees\Http\RequestHandlers\AddMediaFileModal;
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\ReorderMediaFilesPage;
12use Fisharebest\Webtrees\I18N;
13use Fisharebest\Webtrees\Media;
14use Illuminate\Support\Collection;
15
16/**
17 * @var Collection<int,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        <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">
31            <?= view('icons/add') ?>
32            <?= I18N::translate('Add a media file') ?>
33        </a>
34
35        <?php if ($record->mediaFiles()->count() >= 2) : ?>
36            <a class="dropdown-item" href="<?= route(ReorderMediaFilesPage::class, ['xref' => $record->xref(), 'tree' => $record->tree()->name()]) ?>">
37                <?= view('icons/reorder') ?>
38                <?= I18N::translate('Re-order media files') ?>
39            </a>
40        <?php endif ?>
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        <?php if (Auth::isManager($record->tree())) : ?>
72            <div class="dropdown-divider"></div>
73
74            <a class="dropdown-item" href="<?= route(EditRecordPage::class, ['xref' => $record->xref(), 'tree' => $record->tree()->name()]) ?>">
75                <?= view('icons/edit') ?>
76                <?= I18N::translate('Edit') ?>
77            </a>
78        <?php endif ?>
79
80        <div class="dropdown-divider"></div>
81
82        <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()])) ?>">
83            <?= view('icons/delete') ?>
84            <?= I18N::translate('Delete') ?>
85        </a>
86    </div>
87</div>
88