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