xref: /webtrees/resources/views/record-page-menu.phtml (revision 4ff0652c9f716485ce1866f88c40897142051b8b)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\GedcomRecord;
5use Fisharebest\Webtrees\Header;
6use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
7use Fisharebest\Webtrees\Http\RequestHandlers\EditRecordPage;
8use Fisharebest\Webtrees\I18N;
9use Illuminate\Support\Collection;
10
11/**
12 * @var Collection<int,Fact> $clipboard_facts
13 * @var GedcomRecord         $record
14 */
15
16?>
17
18<div class="dropdown wt-page-menu">
19    <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">
20        <?= view('icons/menu') ?>
21        <?= I18N::translate('edit') ?>
22    </button>
23
24    <div class="dropdown-menu dropdown-menu-end wt-page-menu-items" aria-labelledby="page-menu">
25        <a class="dropdown-item" href="<?= route(EditRecordPage::class, ['xref' => $record->xref(), 'tree' => $record->tree()->name()]) ?>">
26            <?= view('icons/edit') ?>
27            <?= I18N::translate('Edit') ?>
28        </a>
29
30        <?php if ($record->missingFacts() !== []) : ?>
31            <div class="dropdown-divider"></div>
32
33            <?= view('record-page-menu-facts', ['record' => $record]) ?>
34        <?php endif ?>
35
36        <?php if ($clipboard_facts->isNotEmpty()) : ?>
37            <div class="dropdown-divider"></div>
38
39            <?= view('record-page-menu-clipboard', ['clipboard_facts' => $clipboard_facts, 'record' => $record]) ?>
40        <?php endif ?>
41
42        <?php if (!$record instanceof Header) : ?>
43            <div class="dropdown-divider"></div>
44
45            <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()])) ?>">
46                <?= view('icons/delete') ?>
47                <?= I18N::translate('Delete') ?>
48            </a>
49        <?php endif ?>
50    </div>
51</div>
52
53