xref: /webtrees/resources/views/modules/faq/config.phtml (revision 3d2c98d1066d5e178a3d1ceb3bdc58b7ba8ee926)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAllPage;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Tree;
7use Illuminate\Support\Collection;
8
9/**
10 * @var Collection<object>   $faqs
11 * @var string               $max_block_order
12 * @var string               $min_block_order
13 * @var string               $title
14 * @var Tree                 $tree
15 * @var array<string,string> $tree_names
16 */
17
18?>
19
20<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ModulesAllPage::class) => I18N::translate('Modules'), $title]]) ?>
21
22<h1><?= $title ?></h1>
23
24<p>
25    <?= /* I18N: FAQ = “Frequently Asked Question” */
26    I18N::translate('FAQs are lists of questions and answers, which allow you to explain the site’s rules, policies, and procedures to your visitors. Questions are typically concerned with privacy, copyright, user-accounts, unsuitable content, requirement for source-citations, etc.') ?>
27    <?= I18N::translate('You may use HTML to format the answer and to add links to other websites.') ?>
28</p>
29
30<p>
31<form method="post" class="form form-inline">
32    <?= csrf_field() ?>
33
34    <label for="tree" class="sr-only">
35        <?= I18N::translate('Family tree') ?>
36    </label>
37    <?= view('components/select', ['name' => 'tree', 'selected' => $tree->name(), 'options' => $tree_names]) ?>
38    <input type="submit" class="btn btn-primary" value="<?= I18N::translate('show') ?>">
39</form>
40</p>
41
42<p>
43    <a href="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminEdit', 'tree' => $tree->name()])) ?>" class="btn btn-link">
44        <?= view('icons/add') ?>
45        <?= /* I18N: FAQ = “Frequently Asked Question” */
46        I18N::translate('Add an FAQ') ?>
47    </a>
48</p>
49
50<table class="table table-bordered">
51    <thead>
52        <tr>
53            <th><?= I18N::translate('Sort order') ?></th>
54            <th><?= I18N::translate('Family tree') ?></th>
55            <th><?= I18N::translate('Question') ?></th>
56            <th><?= I18N::translate('Move up') ?></th>
57            <th><?= I18N::translate('Move down') ?></th>
58            <th><?= I18N::translate('Edit') ?></th>
59            <th><?= I18N::translate('Delete') ?></th>
60        </tr>
61    </thead>
62    <tbody>
63        <?php foreach ($faqs as $faq) : ?>
64            <tr class="faq_edit_pos">
65                <td>
66                    <?= I18N::number($faq->block_order + 1) ?>
67                </td>
68                <td>
69                    <?php if ($faq->gedcom_id === null) : ?>
70                        <?= I18N::translate('All') ?>
71                    <?php else : ?>
72                        <?= e($tree->title()) ?>
73                    <?php endif ?>
74                </td>
75                <td>
76                    <?= e($faq->header) ?>
77                </td>
78                <td>
79                    <?php if ($faq->block_order !== $min_block_order) : ?>
80                        <a href="#" data-post-url="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminMoveUp', 'block_id' => $faq->block_id])) ?>" class="btn btn-secondary">
81                            <?= view('icons/arrow-up') ?>
82                        </a>
83                    <?php endif ?>
84                </td>
85                <td>
86                    <?php if ($faq->block_order !== $max_block_order) : ?>
87                        <a href="#" data-post-url="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminMoveDown', 'block_id' => $faq->block_id])) ?>" class="btn btn-secondary">
88                        <?= view('icons/arrow-down') ?>
89                        </a>
90                    <?php endif ?>
91                </td>
92                <td>
93                    <a href="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminEdit', 'block_id' => $faq->block_id, 'tree' => $tree->name()])) ?>" class="btn btn-primary">
94                        <?= view('icons/edit') ?>
95                    </a>
96                </td>
97                <td>
98                    <a href="#" data-post-url="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminDelete', 'block_id' => $faq->block_id])) ?>" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($faq->header)) ?>" class="btn btn-danger">
99                        <?= view('icons/delete') ?>
100                    </a>
101                </td>
102            </tr>
103        <?php endforeach ?>
104    </tbody>
105</table>
106