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