xref: /webtrees/resources/views/record-page-menu.phtml (revision 30e63383b10bafff54347985dcdbd10c40c33f62)
1<?php
2
3use Fisharebest\Webtrees\Elements\HeaderRecord;
4use Fisharebest\Webtrees\Fact;
5use Fisharebest\Webtrees\GedcomRecord;
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<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-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-right 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 HeaderRecord) : ?>
43            <div class="dropdown-divider"></div>
44
45            <a class="dropdown-item" href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->fullName())) ?>" data-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