1<?php 2 3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 4use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAllPage; 5use Fisharebest\Webtrees\I18N; 6use Fisharebest\Webtrees\Tree; 7use Illuminate\Support\Collection; 8 9/** 10 * @var Collection<stdClass> $stories 11 * @var string $title 12 * @var Tree $tree 13 * @var array<string> $tree_names 14 */ 15 16?> 17 18<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ModulesAllPage::class) => I18N::translate('Modules'), $title]]) ?> 19 20<h1><?= $title ?></h1> 21 22<form method="post" class="row"> 23 <?= csrf_field() ?> 24 25 <div class="col-auto"> 26 <div class="input-group"> 27 <?= view('components/select', ['name' => 'tree', 'selected' => $tree->name(), 'options' => $tree_names, 'aria_label' => I18N::translate('Family tree')]) ?> 28 <input type="submit" class="btn btn-primary" value="<?= I18N::translate('show') ?>"> 29 </div> 30 </div> 31</form> 32 33<p> 34 <a href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'tree' => $tree->name()])) ?>" class="btn btn-link"> 35 <?= view('icons/add') ?> 36 <?= I18N::translate('Add a story') ?> 37 </a> 38</p> 39 40<table 41 class="table table-bordered table-sm datatables d-none" 42 <?= view('lists/datatables-attributes') ?> 43 data-columns="<?= e(json_encode([ 44 null, 45 null, 46 ['sortable' => false], 47 ['sortable' => false], 48 ], JSON_THROW_ON_ERROR)) ?>" 49> 50 <caption> 51 <?= I18N::translate('Stories') ?> 52 </caption> 53 54 <thead> 55 <tr> 56 <th><?= I18N::translate('Individual') ?></th> 57 <th><?= I18N::translate('Story title') ?></th> 58 <th><?= I18N::translate('Edit') ?></th> 59 <th><?= I18N::translate('Delete') ?></th> 60 </tr> 61 </thead> 62 63 <tbody> 64 <?php foreach ($stories as $story) : ?> 65 <tr> 66 <td> 67 <?php if ($story->individual !== null) : ?> 68 <a href="<?= e($story->individual->url()) ?>#tab-stories"> 69 <?= $story->individual->fullName() ?> 70 </a> 71 <?php else : ?> 72 <?= $story->xref ?> 73 <?php endif ?> 74 </td> 75 <td> 76 <?= e($story->title) ?> 77 </td> 78 <td> 79 <a class="btn btn-primary" href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'tree' => $tree->name(), 'block_id' => $story->block_id])) ?>" aria-label="<?= I18N::translate('Edit') ?>"> 80 <?= view('icons/edit') ?> 81 <?= I18N::translate('Edit') ?> 82 </a> 83 </td> 84 <td> 85 <form method="post" action="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminDelete', 'tree' => $tree->name(), 'block_id' => $story->block_id])) ?>"> 86 <?= csrf_field() ?> 87 <button type="submit" class="btn btn-danger" data-wt-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($story->title)) ?>" onclick="return confirm(this.dataset.confirm);" aria-label="<?= I18N::translate('Delete') ?>"> 88 <?= view('icons/delete') ?> 89 <?= I18N::translate('Delete') ?> 90 </button> 91 </form> 92 </td> 93 </tr> 94 <?php endforeach ?> 95 </tbody> 96</table> 97