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