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