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