xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision 9ba014a766385c38470d363a384f5a2c9642a7b8)
1<?php use Fisharebest\Webtrees\I18N; ?>
2<?php use Fisharebest\Webtrees\View; ?>
3
4<h2 class="wt-page-title"><?= $title ?></h2>
5
6<form class="wt-page-content" method="post">
7    <?= csrf_field() ?>
8    <input type="hidden" name="ged" value="<?= e($tree->name()) ?>">
9    <input type="hidden" name="xref" value="<?= e($record->xref()) ?>">
10
11    <p class="text-muted small">
12        <?= 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.') ?>
13    </p>
14    <p class="text-muted small">
15        <?= /* 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>') ?>
16    </p>
17
18    <div class="card">
19        <label class="card-header py-1 px-2" for="fact0">
20            <?= $record->fullName() ?>
21        </label>
22        <div class="card-body form-control py-1 px-2">
23            <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>
24        </div>
25    </div>
26
27    <div id="raw-gedcom-list">
28        <?php foreach ($record->facts() as $fact) : ?>
29            <?php if (!$fact->isPendingDeletion()) : ?>
30                <div class="card my-2">
31                    <label class="card-header py-1 px-2 d-flex" for="fact-<?= e($fact->id()) ?>">
32                        <span class="drag-handle">
33                        <?= view('icons/drag-handle') ?>
34                        </span>
35                        <?= $fact->summary() ?>
36                    </label>
37                    <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
38                    <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>
39                </div>
40            <?php endif ?>
41        <?php endforeach ?>
42
43        <div class="card my-2">
44            <label class="card-header py-1 px-2" for="fact-add">
45                <?= I18N::translate('Add a fact') ?>
46            </label>
47            <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
48            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
49        </div>
50    </div>
51
52    <div class="row form-group">
53        <div class="col-sm-9 offset-sm-3">
54            <button class="btn btn-primary" type="submit">
55                <?= view('icons/save') ?>
56                <?= /* I18N: A button label. */ I18N::translate('save') ?>
57            </button>
58            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
59                <?= view('icons/cancel') ?>
60                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
61            </a>
62        </div>
63    </div>
64</form>
65
66<?php View::push('javascript') ?>
67<script>
68  new Sortable(document.getElementById("raw-gedcom-list"), {
69    handle: '.drag-handle'
70  });
71</script>
72<?php View::endpush() ?>
73