xref: /webtrees/resources/views/modules/faq/config.phtml (revision b4c5c807eb501a4b2f3da3cb8eb38981bf4a3a25)
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<int,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<form method="post" class="row">
31    <?= csrf_field() ?>
32
33    <div class="col-auto">
34        <div class="input-group">
35            <?= view('components/select', ['name' => 'tree', 'selected' => $tree->name(), 'options' => $tree_names, 'aria_label' => I18N::translate('Family tree')]) ?>
36            <input type="submit" class="btn btn-primary" value="<?= I18N::translate('show') ?>">
37        </div>
38    </div>
39</form>
40
41<p>
42    <a href="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminEdit', 'tree' => $tree->name()])) ?>" class="btn btn-link">
43        <?= view('icons/add') ?>
44        <?= /* I18N: FAQ = “Frequently Asked Question” */
45        I18N::translate('Add an FAQ') ?>
46    </a>
47</p>
48
49<table class="table table-bordered">
50    <caption>
51        <?= I18N::translate('Frequently asked questions') ?>
52    </caption>
53
54    <thead>
55        <tr>
56            <th><?= I18N::translate('Sort order') ?></th>
57            <th><?= I18N::translate('Family tree') ?></th>
58            <th><?= I18N::translate('Question') ?></th>
59            <th><?= I18N::translate('Move up') ?></th>
60            <th><?= I18N::translate('Move down') ?></th>
61            <th><?= I18N::translate('Edit') ?></th>
62            <th><?= I18N::translate('Delete') ?></th>
63        </tr>
64    </thead>
65
66    <tbody>
67        <?php foreach ($faqs as $faq) : ?>
68            <tr class="faq_edit_pos">
69                <td>
70                    <?= I18N::number($faq->block_order) ?>
71                </td>
72                <td>
73                    <?php if ($faq->gedcom_id === null) : ?>
74                        <?= I18N::translate('All') ?>
75                    <?php else : ?>
76                        <?= e($tree->title()) ?>
77                    <?php endif ?>
78                </td>
79                <td>
80                    <?= e($faq->header) ?>
81                </td>
82                <td>
83                    <?php if ($faq->block_order !== $min_block_order) : ?>
84                        <a href="#" data-wt-post-url="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminMoveUp', 'block_id' => $faq->block_id])) ?>" class="btn btn-secondary">
85                            <?= view('icons/arrow-up') ?>
86                        </a>
87                    <?php endif ?>
88                </td>
89                <td>
90                    <?php if ($faq->block_order !== $max_block_order) : ?>
91                        <a href="#" data-wt-post-url="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminMoveDown', 'block_id' => $faq->block_id])) ?>" class="btn btn-secondary">
92                        <?= view('icons/arrow-down') ?>
93                        </a>
94                    <?php endif ?>
95                </td>
96                <td>
97                    <a href="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminEdit', 'block_id' => $faq->block_id, 'tree' => $tree->name()])) ?>" aria-label="<?= I18N::translate('Edit') ?>" class="btn btn-primary">
98                        <?= view('icons/edit') ?>
99                    </a>
100                </td>
101                <td>
102                    <a href="#" data-wt-post-url="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminDelete', 'block_id' => $faq->block_id])) ?>" data-wt-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($faq->header)) ?>" aria-label="<?= I18N::translate('Delete') ?>" class="btn btn-danger">
103                        <?= view('icons/delete') ?>
104                    </a>
105                </td>
106            </tr>
107        <?php endforeach ?>
108    </tbody>
109</table>
110