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