xref: /webtrees/resources/views/modules/gedcom_news/list.phtml (revision 1270d2767576ed4a83917769b0ee3613e3b010bf)
171378461SGreg Roach<?php
271378461SGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
571378461SGreg Roachuse Fisharebest\Webtrees\Auth;
671378461SGreg Roachuse Fisharebest\Webtrees\I18N;
77c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree;
87c2c99faSGreg Roachuse Illuminate\Support\Collection;
97c2c99faSGreg Roach
107c2c99faSGreg Roach/**
1136779af1SGreg Roach * @var Collection<int,object> $articles
127c2c99faSGreg Roach * @var int                    $block_id
137c2c99faSGreg Roach * @var int                    $limit
147c2c99faSGreg Roach * @var Tree                   $tree
157c2c99faSGreg Roach */
1671378461SGreg Roach
1771378461SGreg Roach?>
18dd6b2bfcSGreg Roach
19075d1a05SGreg Roach<?php if ($articles->isEmpty()) : ?>
20dd6b2bfcSGreg Roach    <?= I18N::translate('No news articles have been submitted.') ?>
21dd6b2bfcSGreg Roach<?php endif ?>
22dd6b2bfcSGreg Roach
23d70512abSGreg Roach<?php foreach ($articles as $n => $article) : ?>
247c2c99faSGreg Roach    <?php if ($n === $limit && count($articles) > $limit) : ?>
25dd6b2bfcSGreg Roach    <p>
26315eb316SGreg Roach        <button class="btn btn-sm btn-secondary" data-bs-toggle="collapse" data-bs-target="#more-news-<?= e($block_id) ?>" role="button" aria-expanded="false" aria-controls="more-news-<?= e($block_id) ?>">
27d09f5bccSGreg Roach            <?= view('icons/add') ?>
28d09f5bccSGreg Roach            <?= I18N::translate('show more') ?>
29d09f5bccSGreg Roach        </button>
30dd6b2bfcSGreg Roach    </p>
31dd6b2bfcSGreg Roach<div class="collapse" id="more-news-<?= e($block_id) ?>">
32dd6b2bfcSGreg Roach    <?php endif ?>
33dd6b2bfcSGreg Roach
34dd6b2bfcSGreg Roach    <div class="news_box">
3551aa34daSGreg Roach        <div class="news_title" dir="auto"><?= $article->subject ?></div>
364459dc9aSGreg Roach        <div class="news_date"><?= view('components/datetime', ['timestamp' => $article->updated]) ?></div>
3751aa34daSGreg Roach        <div dir="auto"><?= $article->body ?></div>
38dd6b2bfcSGreg Roach
39dd6b2bfcSGreg Roach        <?php if (Auth::isManager($tree)) : ?>
40dd6b2bfcSGreg Roach            <hr>
41d72b284aSGreg Roach            <form method="post" action="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'DeleteNews', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>">
42d72b284aSGreg Roach                <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>">
43dd6b2bfcSGreg Roach                    <?= I18N::translate('Edit') ?>
44dd6b2bfcSGreg Roach                </a>
45dd6b2bfcSGreg Roach                |
46*1270d276SGreg Roach                <button class="btn btn-link" type="submit" data-wt-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($article->subject)) ?>">
47dd6b2bfcSGreg Roach                    <?= I18N::translate('Delete') ?>
48dd6b2bfcSGreg Roach                </button>
4981443e3cSGreg Roach
5081443e3cSGreg Roach                <?= csrf_field() ?>
51dd6b2bfcSGreg Roach            </form>
52dd6b2bfcSGreg Roach        <?php endif ?>
53dd6b2bfcSGreg Roach    </div>
54dd6b2bfcSGreg Roach<?php endforeach ?>
55dd6b2bfcSGreg Roach
567c2c99faSGreg Roach    <?php if (count($articles) > $limit) : ?>
57dd6b2bfcSGreg Roach</div>
58dd6b2bfcSGreg Roach    <?php endif ?>
59dd6b2bfcSGreg Roach
60dd6b2bfcSGreg Roach<?php if (Auth::isManager($tree)) : ?>
61dd6b2bfcSGreg Roach    <p>
62d72b284aSGreg Roach        <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'tree' => $tree->name()])) ?>">
63dd6b2bfcSGreg Roach            <?= I18N::translate('Add a news article') ?>
64dd6b2bfcSGreg Roach        </a>
65dd6b2bfcSGreg Roach    </p>
66dd6b2bfcSGreg Roach<?php endif ?>
67