xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision cacefda1879a630cb123d4cd92f434ddbcc1f10e)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction;
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(EditRawRecordAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content">
12    <?= csrf_field() ?>
13
14    <p class="text-muted small">
15        <?= I18N::translate('This page allows you to bypass the usual forms, and edit the underlying data directly. It is an advanced option, and you should not use it unless you understand the GEDCOM format. If you make a mistake here, it can be difficult to fix.') ?>
16    </p>
17    <p class="text-muted small">
18        <?= /* I18N: %s is a URL */ I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="https://wiki.webtrees.net/w/images-en/Ged551-5.pdf">https://wiki.webtrees.net/w/images-en/Ged551-5.pdf</a>') ?>
19    </p>
20
21    <div class="card">
22        <label class="card-header py-1 px-2" for="fact0">
23            <?= $record->fullName() ?>
24        </label>
25        <div class="card-body form-control py-1 px-2">
26            <textarea class="card-body form-control py-1 px-2" id="fact0" rows="1" dir="ltr">0 @<?= e($record->xref()) ?>@ <?= e($record::RECORD_TYPE) ?></textarea>
27        </div>
28    </div>
29
30    <div id="wt-sortable-list">
31        <?php foreach ($record->facts() as $fact) : ?>
32            <?php if (!$fact->isPendingDeletion()) : ?>
33                <div class="card my-2">
34                    <label class="card-header py-1 px-2 d-flex" for="fact-<?= e($fact->id()) ?>">
35                        <span class="drag-handle">
36                            <?= view('icons/drag-handle') ?>
37                        </span>
38                        <?= $fact->summary() ?>
39                    </label>
40                    <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
41                    <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-<?= e($fact->id()) ?>" name="fact[]" rows="<?= 1 + preg_match_all('/\n/', $fact->gedcom()) ?>"><?= e($fact->gedcom()) ?></textarea>
42                </div>
43            <?php endif ?>
44        <?php endforeach ?>
45
46        <div class="card my-2">
47            <label class="card-header py-1 px-2" for="fact-add">
48                <?= I18N::translate('Add a fact') ?>
49            </label>
50            <input type="hidden" name="fact_id[]" value="">
51            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
52        </div>
53    </div>
54
55    <div class="row form-group">
56        <div class="col-sm-9 offset-sm-3">
57            <button class="btn btn-primary" type="submit">
58                <?= view('icons/save') ?>
59                <?= /* I18N: A button label. */ I18N::translate('save') ?>
60            </button>
61            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
62                <?= view('icons/cancel') ?>
63                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
64            </a>
65        </div>
66    </div>
67</form>
68
69<?php View::push('javascript') ?>
70<script>
71    new Sortable(document.getElementById("wt-sortable-list"), {
72        handle: ".drag-handle",
73    });
74</script>
75<?php View::endpush() ?>
76