xref: /webtrees/resources/views/modules/stories/config.phtml (revision b6017f990d38d8c56e04c0096ce9a7e8745ad4ba)
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
34    class="table table-bordered table-sm datatables d-none"
35    <?= view('lists/datatables-attributes') ?>
36    data-columns="<?= e(json_encode([
37       null,
38       null,
39       ['sortable' => false],
40       ['sortable' => false],
41    ])) ?>"
42>
43    <thead>
44        <tr>
45            <th><?= I18N::translate('Individual') ?></th>
46            <th><?= I18N::translate('Story title') ?></th>
47            <th><?= I18N::translate('Edit') ?></th>
48            <th><?= I18N::translate('Delete') ?></th>
49        </tr>
50    </thead>
51    <tbody>
52        <?php foreach ($stories as $story) : ?>
53            <tr>
54                <td>
55                    <?php if ($story->individual !== null) : ?>
56                        <a href="<?= e($story->individual->url()) ?>#tab-stories">
57                            <?= $story->individual->fullName() ?>
58                        </a>
59                    <?php else : ?>
60                        <?= $story->xref ?>
61                    <?php endif ?>
62                </td>
63                <td>
64                    <?= e($story->title) ?>
65                </td>
66                <td>
67                    <a class="btn btn-primary" href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'tree' => $tree->name(), 'block_id' => $story->block_id])) ?>">
68                        <?= view('icons/edit') ?>
69                        <?= I18N::translate('Edit') ?>
70                    </a>
71                </td>
72                <td>
73                    <form method="post" action="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminDelete', 'tree' => $tree->name(), 'block_id' => $story->block_id])) ?>">
74                        <?= csrf_field() ?>
75                        <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);">
76                            <?= view('icons/delete') ?>
77                            <?= I18N::translate('Delete') ?>
78                        </button>
79                    </form>
80                </td>
81            </tr>
82        <?php endforeach ?>
83    </tbody>
84</table>
85