aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/pages/editable.php
blob: 67c97ca3269e168fb479da3f525a1e1ab4d05f77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<article>
    <form class="pageEditForm nobackground" hx-post="/fragment/page/<?= $note->id ?>/edit" hx-target="closest article"
        hx-swap="outerHTML">
        <div class="row">
            <label for="pageTitle"><?= __('note.page.new.title.label') ?></label>
            <input type="text" id="pageTitle" name="title" value="<?= htmlspecialchars($page->title) ?>" required>
        </div>

        <div class="row">
            <a class="pageAuthor" href="/@/<?= htmlspecialchars($note->author->getFullHandle()) ?>">
                <?php call_template('actor/avatar', ['actor' => $note->author]); ?>
                <span><?= __f(
                    'note.page.author',
                    '<span class="displayName">' . htmlspecialchars($note->author->displayName) . '</span>'
                ) ?></span>
            </a>
            <div class="created">
                <?= __f('note.page.created', format_datetime($note->created)) ?>
            </div>
            <?php if (isset($note->modified) && $note->modified != $note->created): ?>
                <div class="modified">
                    <?= __f('note.page.modified', format_datetime($note->modified)) ?>
                </div>
            <?php endif; ?>
            <hr>
        </div>

        <div class="row">
            <label for="pageBody"><?= __('note.page.new.body.label') ?></label>
            <textarea id="pageBody" name="body" required><?= $page->content['text/markdown'] ?></textarea>
        </div>

        <div class="row actionButtons">
            <button type="button" class="secondary" hx-get="/fragment/page/<?= $note->id ?>" hx-target="closest article"
                hx-swap="outerHTML"><?= __('form.discardChanges') ?></button>
            <button type="submit" class="primary"><?= __('form.saveChanges') ?></button>
        </div>
    </form>
</article>