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