aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/reply_form.php
blob: 915189e6a7b0868d25bfd8c562bf5256899795b9 (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
<?php
use Digitigrade\Model\UserAccount;

$user = UserAccount::findByCurrentSession();

$summaryText = '';
if ($note->summary) {
    if (strtolower(substr($note->summary, 0, 3)) == 're:') {
        $summaryText = $note->summary;
    } else {
        $summaryText = "re: $note->summary";
    }
}
?>
<form class="noteReplyForm" id="replyForm-<?= $note->id ?>"
    _="on submit send toggle to previous <button.reply/> then wait 1s then trigger update on #liveTimelineUpdater on toggle or submit toggle @hidden"
    hidden hx-post="/fragment/note/<?= $note->id ?>/reply" hx-disabled-elt="find button" hx-swap="outerHTML">
    <div class="row">
        <label for="replyContent-<?= $note->id ?>"><?= __('writeReply.label') ?></label>
        <textarea id="replyContent-<?= $note->id ?>" name="content" required autocomplete="off"></textarea>
    </div>
    <div class="row">
        <label for="replySummary-<?= $note->id ?>"><?= __('writeNote.summary.label') ?></label>
        <input type="text" id="replySummary-<?= $note->id ?>" name="summary" autocomplete="off"
            value="<?= $summaryText ?>">
    </div>
    <div class="row">
        <label class="standalone"><?= __('writeNote.mentions.label') ?></label>
        <?php foreach (array_merge($note->mentions, [$note->author]) as $m) {
            if ($m != $user?->actor) {
                call_template('user_mention_pill', ['type' => 'user', 'actor' => $m]);
            }
        } ?>
        <?php call_template('user_mention_pill'); ?>
    </div>
    <div class="row">
        <button class="primary"><?= __('writeReply.action') ?></button>
    </div>
</form>