xref: /webtrees/resources/views/modules/stories/config.phtml (revision 00b1984e374faddab4698e73088f0c964e529b65)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\I18N;
5
6?>
7
8<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route('modules') => I18N::translate('Modules'), $title]]) ?>
9
10<h1><?= $title ?></h1>
11
12<form method="post" class="form-inline mb-4">
13    <?= csrf_field() ?>
14
15    <label for="tree" class="sr-only">
16        <?= I18N::translate('Family tree') ?>
17    </label>
18
19    <?= view('components/select', ['name' => 'tree', 'selected' => $tree->name(), 'options' => $tree_names]) ?>
20    <button type="submit" class="btn btn-primary">
21        <?= I18N::translate('show') ?>
22    </button>
23</form>
24
25<p>
26    <a href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'tree' => $tree->name()])) ?>" class="btn btn-link">
27        <?= view('icons/add') ?>
28        <?= I18N::translate('Add a story') ?>
29    </a>
30</p>
31
32<table class="table table-bordered table-sm">
33    <thead>
34        <tr>
35            <th><?= I18N::translate('Individual') ?></th>
36            <th><?= I18N::translate('Story title') ?></th>
37            <th><?= I18N::translate('Edit') ?></th>
38            <th><?= I18N::translate('Delete') ?></th>
39        </tr>
40    </thead>
41    <tbody>
42        <?php foreach ($stories as $story) : ?>
43            <tr>
44                <td>
45                    <?php if ($story->individual !== null) : ?>
46                        <a href="<?= e($story->individual->url()) ?>#tab-stories">
47                            <?= $story->individual->fullName() ?>
48                        </a>
49                    <?php else : ?>
50                        <?= $story->xref ?>
51                    <?php endif ?>
52                </td>
53                <td>
54                    <?= e($story->title) ?>
55                </td>
56                <td>
57                    <a class="btn btn-primary" href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'tree' => $tree->name(), 'block_id' => $story->block_id])) ?>">
58                        <?= view('icons/edit') ?>
59                        <?= I18N::translate('Edit') ?>
60                    </a>
61                </td>
62                <td>
63                    <form method="post" action="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminDelete', 'tree' => $tree->name(), 'block_id' => $story->block_id])) ?>">
64                        <?= csrf_field() ?>
65                        <button type="submit" class="btn btn-danger" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($story->title)) ?>" onclick="return confirm(this.dataset.confirm);">
66                            <?= view('icons/delete') ?>
67                            <?= I18N::translate('Delete') ?>
68                        </button>
69                    </form>
70                </td>
71            </tr>
72        <?php endforeach ?>
73    </tbody>
74</table>
75