xref: /webtrees/resources/views/modules/gedcom_news/list.phtml (revision 3eae54c8a20b98985facfcff8d58c982338bbf85)
1<?php use Fisharebest\Webtrees\Auth; ?>
2<?php use Fisharebest\Webtrees\I18N; ?>
3
4<?php if (empty($articles)) : ?>
5    <?= I18N::translate('No news articles have been submitted.') ?>
6<?php endif ?>
7
8<?php foreach ($articles as $n => $article) : ?>
9    <?php if ($n === 5 && count($articles) > 5) : ?>
10        <p>
11            <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') ?>
12            </a>
13        </p>
14        <div class="collapse" id="more-news-<?= e($block_id) ?>">
15    <?php endif ?>
16
17    <div class="news_box">
18        <div class="news_title"><?= $article->subject ?></div>
19        <div class="news_date"><?= view('components/datetime', ['timestamp' => $article->updated]) ?></div>
20        <?= $article->body ?>
21
22        <?php if (Auth::isManager($tree)) : ?>
23            <hr>
24            <form action="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'DeleteNews', 'news_id' => $article->news_id, 'ged' => $tree->name()])) ?>" method="post">
25                <?= csrf_field() ?>
26                <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'news_id' => $article->news_id, 'ged' => $tree->name()])) ?>">
27                    <?= I18N::translate('Edit') ?>
28                </a>
29                |
30                <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);">
31                    <?= I18N::translate('Delete') ?>
32                </button>
33            </form>
34        <?php endif ?>
35    </div>
36<?php endforeach ?>
37
38<?php if (count($articles) > 5) : ?>
39    </div>
40<?php endif ?>
41
42<?php if (Auth::isManager($tree)) : ?>
43    <p>
44        <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'ged' => $tree->name()])) ?>">
45            <?= I18N::translate('Add a news article') ?>
46        </a>
47    </p>
48<?php endif ?>
49