171378461SGreg Roach<?php 271378461SGreg Roach 371378461SGreg Roachuse Fisharebest\Webtrees\Auth; 471378461SGreg Roachuse Fisharebest\Webtrees\I18N; 5*7c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree; 6*7c2c99faSGreg Roachuse Illuminate\Support\Collection; 7*7c2c99faSGreg Roach 8*7c2c99faSGreg Roach/** 9*7c2c99faSGreg Roach * @var Collection<object> $articles 10*7c2c99faSGreg Roach * @var int $block_id 11*7c2c99faSGreg Roach * @var int $limit 12*7c2c99faSGreg Roach * @var Tree $tree 13*7c2c99faSGreg Roach */ 1471378461SGreg Roach 1571378461SGreg Roach?> 16dd6b2bfcSGreg Roach 17075d1a05SGreg Roach<?php if ($articles->isEmpty()) : ?> 18dd6b2bfcSGreg Roach <?= I18N::translate('No news articles have been submitted.') ?> 19dd6b2bfcSGreg Roach<?php endif ?> 20dd6b2bfcSGreg Roach 21d70512abSGreg Roach<?php foreach ($articles as $n => $article) : ?> 22*7c2c99faSGreg Roach <?php if ($n === $limit && count($articles) > $limit) : ?> 23dd6b2bfcSGreg Roach <p> 24d09f5bccSGreg Roach <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) ?>"> 25d09f5bccSGreg Roach <?= view('icons/add') ?> 26d09f5bccSGreg Roach <?= I18N::translate('show more') ?> 27d09f5bccSGreg Roach </button> 28dd6b2bfcSGreg Roach </p> 29dd6b2bfcSGreg Roach<div class="collapse" id="more-news-<?= e($block_id) ?>"> 30dd6b2bfcSGreg Roach <?php endif ?> 31dd6b2bfcSGreg Roach 32dd6b2bfcSGreg Roach <div class="news_box"> 3351aa34daSGreg Roach <div class="news_title" dir="auto"><?= $article->subject ?></div> 344459dc9aSGreg Roach <div class="news_date"><?= view('components/datetime', ['timestamp' => $article->updated]) ?></div> 3551aa34daSGreg Roach <div dir="auto"><?= $article->body ?></div> 36dd6b2bfcSGreg Roach 37dd6b2bfcSGreg Roach <?php if (Auth::isManager($tree)) : ?> 38dd6b2bfcSGreg Roach <hr> 39d72b284aSGreg Roach <form method="post" action="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'DeleteNews', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>"> 40dd6b2bfcSGreg Roach <?= csrf_field() ?> 41d72b284aSGreg Roach <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'news_id' => $article->news_id, 'tree' => $tree->name()])) ?>"> 42dd6b2bfcSGreg Roach <?= I18N::translate('Edit') ?> 43dd6b2bfcSGreg Roach </a> 44dd6b2bfcSGreg Roach | 45dd6b2bfcSGreg 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);"> 46dd6b2bfcSGreg Roach <?= I18N::translate('Delete') ?> 47dd6b2bfcSGreg Roach </button> 48dd6b2bfcSGreg Roach </form> 49dd6b2bfcSGreg Roach <?php endif ?> 50dd6b2bfcSGreg Roach </div> 51dd6b2bfcSGreg Roach<?php endforeach ?> 52dd6b2bfcSGreg Roach 53*7c2c99faSGreg Roach <?php if (count($articles) > $limit) : ?> 54dd6b2bfcSGreg Roach</div> 55dd6b2bfcSGreg Roach <?php endif ?> 56dd6b2bfcSGreg Roach 57dd6b2bfcSGreg Roach<?php if (Auth::isManager($tree)) : ?> 58dd6b2bfcSGreg Roach <p> 59d72b284aSGreg Roach <a class="btn btn-link" href="<?= e(route('module', ['module' => 'gedcom_news', 'action' => 'EditNews', 'tree' => $tree->name()])) ?>"> 60dd6b2bfcSGreg Roach <?= I18N::translate('Add a news article') ?> 61dd6b2bfcSGreg Roach </a> 62dd6b2bfcSGreg Roach </p> 63dd6b2bfcSGreg Roach<?php endif ?> 64