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