xref: /webtrees/resources/views/edit/raw-gedcom-fact.phtml (revision c8988e0a2055da8350ae6305fcb8bb742189f4ae)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\Gedcom;
5use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactAction;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\View;
8use Fisharebest\Webtrees\Webtrees;
9
10/**
11 * @var Fact        $fact
12 * @var string      $title
13 * @var string|null $url
14 */
15
16?>
17
18<h2 class="wt-page-title"><?= $title ?></h2>
19
20<form method="post" id="edit-raw-gedcom" action="<?= e(route(EditRawFactAction::class, ['tree' => $fact->record()->tree()->name(), 'xref' => $fact->record()->xref(), 'fact_id' => $fact->id()])) ?>" class="wt-page-content">
21    <?= csrf_field() ?>
22    <input type="hidden" name="url" value="<?= e($url ?? $fact->record()->url()) ?>">
23
24    <div class="form-text">
25        <?= 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.') ?>
26    </div>
27    <div class="form-text">
28        <?= /* 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>') ?>
29    </div>
30
31    <div class="card my-2">
32        <label class="card-header py-1 px-2 d-flex" for="gedcom">
33            <?= $fact->summary() ?>
34        </label>
35        <textarea class="card-body form-control py-1 px-2" data-wt-pattern="<?= e(Gedcom::REGEX_FACT) ?>" id="gedcom" name="gedcom" rows="<?= 5 + preg_match_all('/\n/', $fact->gedcom()) ?>" dir="ltr"><?= e($fact->gedcom()) ?></textarea>
36    </div>
37
38    <div class="row mb-3">
39        <div class="col-sm-9 offset-sm-3">
40            <button class="btn btn-primary" type="submit">
41                <?= view('icons/save') ?>
42                <?= /* I18N: A button label. */ I18N::translate('save') ?>
43            </button>
44            <a class="btn btn-secondary" href="<?= e($fact->record()->url()) ?>">
45                <?= view('icons/cancel') ?>
46                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
47            </a>
48        </div>
49    </div>
50</form>
51
52<?php View::push('javascript') ?>
53<script>
54  webtrees.textareaPatterns(document.getElementById('edit-raw-gedcom'));
55</script>
56<?php View::endpush() ?>
57
58