xref: /webtrees/resources/views/edit/reorder-media.phtml (revision afa67798854828b1edc33dd077960ec2b18e6140)
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    <?= csrf_field() ?>
19
20    <div class="wt-sortable-list">
21        <?php foreach ($individual->facts(['OBJE']) as $fact) : ?>
22            <div class="card my-2 wt-sortable-item">
23                <input type="hidden" name="order[]" value="<?= $fact->id() ?>">
24                <div class="card-header">
25                    <?= view('edit/reorder-card-header', ['title' => $fact->target()->fullName()]) ?>
26                </div>
27
28                <div class="card-body">
29                    <?= $fact->target()->displayImage(100, 100, 'contain') ?>
30                </div>
31            </div>
32        <?php endforeach ?>
33    </div>
34
35    <p>
36        <button class="btn btn-primary" type="submit">
37            <?= view('icons/save') ?>
38            <?= /* I18N: A button label. */ I18N::translate('save') ?>
39        </button>
40
41        <a class="btn btn-secondary" href="<?= e($individual->url()) ?>">
42            <?= view('icons/cancel') ?>
43            <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
44        </a>
45    </p>
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