xref: /webtrees/resources/views/edit/reorder-media.phtml (revision c4cbcd7b5d2995f2119e8970ddb302651026bf90)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaAction;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\Individual;
6use Fisharebest\Webtrees\View;
7
8/**
9 * @var Individual $individual
10 * @var string     $title
11 */
12
13?>
14
15<h2 class="wt-page-title"><?= $title ?></h2>
16
17<form method="post" action="<?= e(route(ReorderMediaAction::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>" class="wt-page-content">
18    <div class="wt-sortable-list">
19        <?php foreach ($individual->facts(['OBJE']) as $fact) : ?>
20            <div class="card my-2 wt-sortable-item">
21                <input type="hidden" name="order[]" value="<?= $fact->id() ?>">
22                <div class="card-header">
23                    <?= view('edit/reorder-card-header', ['title' => $fact->target()->fullName()]) ?>
24                </div>
25
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
45    <?= csrf_field() ?>
46</form>
47
48<?php View::push('javascript') ?>
49<script>
50    new Sortable(document.querySelector(".wt-sortable-list"), {
51        handle: ".card-header",
52    });
53</script>
54<?php View::endpush() ?>
55