xref: /webtrees/resources/views/edit/reorder-media.phtml (revision 26420f84cb96928cdc566963a4499db677a38ff9)
1<?php use Fisharebest\Webtrees\I18N; ?>
2<?php use Fisharebest\Webtrees\View; ?>
3
4<h2 class="wt-page-title"><?= $title ?></h2>
5
6<form class="wt-page-content" method="post">
7    <?= csrf_field() ?>
8    <div class="wt-sortable-list">
9        <?php foreach ($individual->facts(['OBJE']) as $fact) : ?>
10            <div class="card mb-2 wt-sortable-item">
11                <input type="hidden" name="order[]" value="<?= $fact->id() ?>">
12                <h3 class="card-header">
13                    <?= view('icons/drag-handle') ?>
14                    <?= $fact->target()->fullName() ?>
15                </h3>
16                <div class="card-body">
17                    <?= $fact->target()->displayImage(100, 100, 'contain') ?>
18                </div>
19            </div>
20        <?php endforeach ?>
21    </div>
22
23    <p>
24        <button class="btn btn-primary" type="submit">
25            <?= view('icons/save') ?>
26            <?= /* I18N: A button label. */ I18N::translate('save') ?>
27        </button>
28
29        <a class="btn btn-secondary" href="<?= e($individual->url()) ?>">
30            <?= view('icons/cancel') ?>
31            <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
32        </a>
33    </p>
34</form>
35
36<?php View::push('javascript') ?>
37<script>
38  new Sortable(document.querySelector(".wt-sortable-list"), {});
39</script>
40<?php View::endpush() ?>
41