xref: /webtrees/resources/views/modules/user_blog/list.phtml (revision 4cf33693bbcbe509133373d32b338f0e76f0bc54)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\I18N;
5
6?>
7
8<?php if ($articles->isEmpty()) : ?>
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            <button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target="#more-news-<?= e($block_id) ?>" role="button" aria-expanded="false" aria-controls="more-news-<?= e($block_id) ?>">
16                <?= view('icons/add') ?>
17                <?= I18N::translate('show more') ?>
18            </button>
19        </p>
20        <div class="collapse" id="more-news-<?= e($block_id) ?>">
21    <?php endif ?>
22
23    <div class="news_box">
24        <div class="news_title" dir="auto"><?= $article->subject ?></div>
25        <div class="news_date"><?= view('components/datetime', ['timestamp' => $article->updated]) ?></div>
26        <div dir="auto"><?= $article->body ?></div>
27
28        <?php if (Auth::isManager($tree)) : ?>
29            <hr>
30            <form method="post" action="<?= e(route('module', ['module' => 'user_blog', 'action' => 'DeleteJournal', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>">
31                <?= csrf_field() ?>
32                <a class="btn btn-link" href="<?= e(route('module', ['module' => 'user_blog', 'action' => 'EditJournal', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>">
33                    <?= I18N::translate('Edit') ?>
34                </a>
35                |
36                <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);">
37                    <?= I18N::translate('Delete') ?>
38                </button>
39            </form>
40        <?php endif ?>
41    </div>
42<?php endforeach ?>
43
44<?php if (count($articles) > 5) : ?>
45    </div>
46<?php endif ?>
47
48<p>
49    <a class="btn btn-link" href="<?= e(route('module', ['module' => 'user_blog', 'action' => 'EditJournal', 'tree' => $tree->name()])) ?>">
50        <?= I18N::translate('Add a journal entry') ?>
51    </a>
52</p>
53