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