xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision ad7270802ba57a28d195fc58fcc55f26458a779a)
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->getFullName() ?>
21        </label>
22        <div class="card-body form-control py-1 px-2">
23            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact0" rows="1">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                        <?= view('icons/drag-handle') ?>
33                        <?= $fact->summary() ?>
34                    </label>
35                    <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
36                    <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-<?= e($fact->id()) ?>" name="fact[]" pattern="<?= e($pattern) ?>" rows="<?= 1 + preg_match_all('/\n/', $fact->gedcom()) ?>"><?= e($fact->gedcom()) ?></textarea>
37                </div>
38            <?php endif ?>
39        <?php endforeach ?>
40
41        <div class="card my-2">
42            <label class="card-header py-1 px-2" for="fact-add">
43                <?= I18N::translate('Add a fact') ?>
44            </label>
45            <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
46            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" pattern="<?= e($pattern) ?>" rows="2"></textarea>
47        </div>
48    </div>
49
50    <div class="row form-group">
51        <div class="col-sm-9 offset-sm-3">
52            <button class="btn btn-primary" type="submit">
53                <?= view('icons/save') ?>
54                <?= /* I18N: A button label. */ I18N::translate('save') ?>
55            </button>
56            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
57                <?= view('icons/cancel') ?>
58                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
59            </a>
60        </div>
61    </div>
62</form>
63
64<?php View::push('javascript') ?>
65<script>
66  new Sortable(document.getElementById("raw-gedcom-list"), {
67    handle: '.drag-handle'
68  });
69</script>
70<?php View::endpush() ?>
71