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