xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision bb03c9f048b83092098d5e46c2ab323ae7e2b314)
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        <div class="card-body form-control py-1 px-2">
27            <textarea class="card-body form-control py-1 px-2" id="fact0" rows="1" dir="ltr" readonly><?= e($level0) ?></textarea>
28        </div>
29    </div>
30
31    <div class="wt-sortable-list">
32        <?php foreach ($record->facts([], false, null, true) as $fact) : ?>
33            <div class="card my-2 wt-sortable-item">
34                <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
35                <div class="card-header">
36                    <?= view('edit/reorder-card-header', ['title' => $fact->summary()]) ?>
37                </div>
38                <label class="sr-only" for="fact-<?= e($fact->id()) ?>"><?= $fact->summary() ?></label>
39
40                <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>
41            </div>
42        <?php endforeach ?>
43
44        <div class="card my-2">
45            <label class="card-header py-1 px-2" for="fact-add">
46                <?= I18N::translate('Add a fact') ?>
47            </label>
48            <input type="hidden" name="fact_id[]" value="">
49            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
50        </div>
51    </div>
52
53    <div class="row form-group">
54        <div class="col-sm-9 offset-sm-3">
55            <button class="btn btn-primary" type="submit">
56                <?= view('icons/save') ?>
57                <?= /* I18N: A button label. */ I18N::translate('save') ?>
58            </button>
59            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
60                <?= view('icons/cancel') ?>
61                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
62            </a>
63        </div>
64    </div>
65</form>
66
67<?php View::push('javascript') ?>
68<script>
69    new Sortable(document.querySelector(".wt-sortable-list"), {
70        handle: ".card-header",
71    });
72</script>
73<?php View::endpush() ?>
74