xref: /webtrees/resources/views/modules/gedcom_news/list.phtml (revision d72b284a0846ca045e548a1c77ad11813bcbab92)
171378461SGreg Roach<?php
271378461SGreg Roach
371378461SGreg Roachuse Fisharebest\Webtrees\Auth;
471378461SGreg Roachuse Fisharebest\Webtrees\I18N;
571378461SGreg Roach
671378461SGreg Roach?>
7dd6b2bfcSGreg Roach
8dd6b2bfcSGreg Roach<?php if (empty($articles)) : ?>
9dd6b2bfcSGreg Roach    <?= I18N::translate('No news articles have been submitted.') ?>
10dd6b2bfcSGreg Roach<?php endif ?>
11dd6b2bfcSGreg Roach
1271378461SGreg Roach<?php foreach ($articles
1371378461SGreg Roach
1471378461SGreg Roach               as $n => $article) : ?>
15dd6b2bfcSGreg Roach<?php if ($n === 5 && count($articles) > 5) : ?>
16dd6b2bfcSGreg Roach    <p>
17dd6b2bfcSGreg Roach        <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') ?>
18dd6b2bfcSGreg Roach        </a>
19dd6b2bfcSGreg Roach    </p>
20dd6b2bfcSGreg Roach<div class="collapse" id="more-news-<?= e($block_id) ?>">
21dd6b2bfcSGreg Roach    <?php endif ?>
22dd6b2bfcSGreg Roach
23dd6b2bfcSGreg Roach    <div class="news_box">
2451aa34daSGreg Roach        <div class="news_title" dir="auto"><?= $article->subject ?></div>
254459dc9aSGreg Roach        <div class="news_date"><?= view('components/datetime', ['timestamp' => $article->updated]) ?></div>
2651aa34daSGreg Roach        <div dir="auto"><?= $article->body ?></div>
27dd6b2bfcSGreg Roach
28dd6b2bfcSGreg Roach        <?php if (Auth::isManager($tree)) : ?>
29dd6b2bfcSGreg Roach            <hr>
30*d72b284aSGreg Roach            <form method="post" action="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'DeleteNews', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>">
31dd6b2bfcSGreg Roach                <?= csrf_field() ?>
32*d72b284aSGreg Roach                <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>">
33dd6b2bfcSGreg Roach                    <?= I18N::translate('Edit') ?>
34dd6b2bfcSGreg Roach                </a>
35dd6b2bfcSGreg Roach                |
36dd6b2bfcSGreg Roach                <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);">
37dd6b2bfcSGreg Roach                    <?= I18N::translate('Delete') ?>
38dd6b2bfcSGreg Roach                </button>
39dd6b2bfcSGreg Roach            </form>
40dd6b2bfcSGreg Roach        <?php endif ?>
41dd6b2bfcSGreg Roach    </div>
42dd6b2bfcSGreg Roach    <?php endforeach ?>
43dd6b2bfcSGreg Roach
44dd6b2bfcSGreg Roach    <?php if (count($articles) > 5) : ?>
45dd6b2bfcSGreg Roach</div>
46dd6b2bfcSGreg Roach<?php endif ?>
47dd6b2bfcSGreg Roach
48dd6b2bfcSGreg Roach<?php if (Auth::isManager($tree)) : ?>
49dd6b2bfcSGreg Roach    <p>
50*d72b284aSGreg Roach        <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'tree' => $tree->name()])) ?>">
51dd6b2bfcSGreg Roach            <?= I18N::translate('Add a news article') ?>
52dd6b2bfcSGreg Roach        </a>
53dd6b2bfcSGreg Roach    </p>
54dd6b2bfcSGreg Roach<?php endif ?>
55