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