xref: /webtrees/resources/views/edit/reorder-media.phtml (revision 0b4092ed8e31e3588eb143d0ade6c4a411367da8)
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                <div class="card-header">
13                    <span class="drag-handle">
14                        <?= view('icons/drag-handle') ?>
15                    </span>
16                    <?= $fact->target()->fullName() ?>
17                </div>
18                <div class="card-body">
19                    <?= $fact->target()->displayImage(100, 100, 'contain') ?>
20                </div>
21            </div>
22        <?php endforeach ?>
23    </div>
24
25    <p>
26        <button class="btn btn-primary" type="submit">
27            <?= view('icons/save') ?>
28            <?= /* I18N: A button label. */ I18N::translate('save') ?>
29        </button>
30
31        <a class="btn btn-secondary" href="<?= e($individual->url()) ?>">
32            <?= view('icons/cancel') ?>
33            <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
34        </a>
35    </p>
36</form>
37
38<?php View::push('javascript') ?>
39<script>
40  new Sortable(document.querySelector(".wt-sortable-list"), {
41      handle: '.drag-handle'
42  });
43</script>
44<?php View::endpush() ?>
45