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