xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision dec352c1d7404cdd35c9b1a1b5d97f29e7c4ebb5)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\View;
6use Fisharebest\Webtrees\Webtrees;
7
8?>
9
10<h2 class="wt-page-title"><?= $title ?></h2>
11
12<form method="post" action="<?= e(route(EditRawRecordAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content">
13    <?= csrf_field() ?>
14
15    <p class="text-muted small">
16        <?= 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.') ?>
17    </p>
18    <p class="text-muted small">
19        <?= /* I18N: %s is a URL */ I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="' . e(Webtrees::GEDCOM_PDF) . '">' . e(Webtrees::GEDCOM_PDF) . '</a>') ?>
20    </p>
21
22    <div class="card">
23        <label class="card-header py-1 px-2" for="fact0">
24            <?= $record->fullName() ?>
25        </label>
26        <textarea class="card-body form-control py-1 px-2" id="fact0" rows="1" dir="ltr" readonly disabled><?= e($level0) ?></textarea>
27    </div>
28
29    <div class="wt-sortable-list">
30        <?php foreach ($record->facts([], false, null, true) as $fact) : ?>
31            <div class="card my-2 wt-sortable-item">
32                <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
33                <div class="card-header">
34                    <?= view('edit/reorder-card-header', ['title' => $fact->summary()]) ?>
35                </div>
36                <label class="sr-only" for="fact-<?= e($fact->id()) ?>"><?= $fact->summary() ?></label>
37
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 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="">
47            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></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.querySelector(".wt-sortable-list"), {
68        handle: ".card-header",
69    });
70</script>
71<?php View::endpush() ?>
72