xref: /webtrees/resources/views/modules/gedcom_news/list.phtml (revision 7ff867dcdca30dc068e32b6a2ce421b753e8df89)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\I18N;
5
6?>
7
8<?php if (empty($articles)) : ?>
9    <?= I18N::translate('No news articles have been submitted.') ?>
10<?php endif ?>
11
12<?php foreach ($articles
13
14               as $n => $article) : ?>
15<?php if ($n === 5 && count($articles) > 5) : ?>
16    <p>
17        <a class="btn btn-link" data-toggle="collapse" data-target="#more-news-<?= e($block_id) ?>" role="button" aria-expanded="false" aria-controls="more-news-<?= e($block_id) ?>"><?= I18N::translate('More news articles') ?>
18        </a>
19    </p>
20<div class="collapse" id="more-news-<?= e($block_id) ?>">
21    <?php endif ?>
22
23    <div class="news_box">
24        <div class="news_title" dir="auto"><?= $article->subject ?></div>
25        <div class="news_date"><?= view('components/datetime', ['timestamp' => $article->updated]) ?></div>
26        <div dir="auto"><?= $article->body ?></div>
27
28        <?php if (Auth::isManager($tree)) : ?>
29            <hr>
30            <form method="post" action="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'DeleteNews', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>">
31                <?= csrf_field() ?>
32                <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>">
33                    <?= I18N::translate('Edit') ?>
34                </a>
35                |
36                <button class="btn btn-link" type="submit" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($article->subject)) ?>" onclick="return confirm(this.dataset.confirm);">
37                    <?= I18N::translate('Delete') ?>
38                </button>
39            </form>
40        <?php endif ?>
41    </div>
42    <?php endforeach ?>
43
44    <?php if (count($articles) > 5) : ?>
45</div>
46<?php endif ?>
47
48<?php if (Auth::isManager($tree)) : ?>
49    <p>
50        <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'tree' => $tree->name()])) ?>">
51            <?= I18N::translate('Add a news article') ?>
52        </a>
53    </p>
54<?php endif ?>
55