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