xref: /webtrees/resources/views/individual-page-menu.phtml (revision 0b9d41e02726e70fc84276f518c76d72907ae8ac)
1<?php use Fisharebest\Webtrees\Auth; ?>
2<?php use Fisharebest\Webtrees\I18N; ?>
3
4<div class="dropdown wt-page-menu">
5    <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">
6        <?= view('icons/edit') ?>
7        <?= I18N::translate('edit') ?>
8    </button>
9
10    <div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu">
11        <a class="dropdown-item" href="<?= e(route('add-name', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
12            <?= view('icons/add') ?>
13            <?= I18N::translate('Add a name') ?>
14        </a>
15
16        <?php if ($count_names > 1) : ?>
17            <a class="dropdown-item" href="<?= e(route('reorder-names', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
18                <?= view('icons/reorder') ?>
19                <?= I18N::translate('Re-order names') ?>
20            </a>
21        <?php else : ?>
22            <div class="dropdown-item disabled">
23                <?= view('icons/spacer') ?>
24                <?= I18N::translate('Re-order names') ?>
25            </div>
26        <?php endif ?>
27
28        <div class="dropdown-divider"></div>
29
30        <?php if ($count_sex === 0) : ?>
31            <a class="dropdown-item" href="<?= e(route('add-fact', ['fact' => 'SEX', 'ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
32                <?= view('icons/edit') ?>
33                <?= I18N::translate('Edit the gender') ?>
34            </a>
35        <?php endif ?>
36
37        <?php foreach ($individual->facts(['SEX']) as $fact) : ?>
38            <?php if ($fact->canEdit()) : ?>
39                <a class="dropdown-item" href="<?= e(route('edit-fact', ['xref' => $individual->xref(), 'fact_id' => $fact->id(), 'ged' => $individual->tree()->name()])) ?>">
40                    <?= view('icons/edit') ?>
41                    <?= I18N::translate('Edit the gender') ?>
42                </a>
43            <?php endif ?>
44        <?php endforeach ?>
45
46        <div class="dropdown-divider"></div>
47
48        <?php if ($individual->spouseFamilies()->count() > 1) : ?>
49            <a class="dropdown-item" href="<?= e(route('reorder-spouses', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
50                <?= view('icons/reorder') ?>
51                <?= I18N::translate('Re-order families') ?>
52            </a>
53        <?php else : ?>
54            <div class="dropdown-item disabled">
55                <?= view('icons/spacer') ?>
56                <?= I18N::translate('Re-order families') ?>
57            </div>
58        <?php endif ?>
59
60        <div class="dropdown-divider"></div>
61
62        <a class="dropdown-item" href="<?= e(route('add-fact', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'OBJE'])) ?>">
63            <?= view('icons/add') ?>
64            <?= I18N::translate('Add a media object') ?>
65        </a>
66
67        <?php if ($individual->facts(['OBJE'])->count() > 1) : ?>
68            <a class="dropdown-item" href="<?= e(route('reorder-media', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
69                <?= view('icons/reorder') ?>
70                <?= I18N::translate('Re-order media') ?>
71            </a>
72        <?php else : ?>
73            <div class="dropdown-item disabled">
74                <?= view('icons/spacer') ?>
75                <?= I18N::translate('Re-order media') ?>
76            </div>
77        <?php endif ?>
78
79        <div class="dropdown-divider"></div>
80
81        <a class="dropdown-item" href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($individual->fullName())) ?>" onclick="return confirm(this.dataset.confirm) && delete_record('<?= e($individual->xref()) ?>', '<?= e($individual->tree()->name()) ?>');">
82            <?= view('icons/delete') ?>
83            <?= I18N::translate('Delete') ?>
84        </a>
85
86        <?php if (Auth::isAdmin() || $individual->tree()->getPreference('SHOW_GEDCOM_RECORD')) : ?>
87            <a class="dropdown-item" href="<?= e(route('edit-raw-record', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
88                <?= view('icons/edit') ?>
89                <?= I18N::translate('Edit the raw GEDCOM') ?>
90            </a>
91        <?php endif ?>
92    </div>
93</div>
94