diff options
| author | winter | 2025-03-15 18:53:29 +0000 |
|---|---|---|
| committer | winter | 2025-03-15 18:53:29 +0000 |
| commit | e0588a6113ff6b3c1000fa6c82629f81fb5e05b5 (patch) | |
| tree | ef6beb046a7dcc7542b88f0962d4e5e264895b7a /templates/note/reply_form.php | |
| parent | 61b122e88cc6783b4d0cf5142a22002f8e558c60 (diff) | |
[refactor] move some templates to subdirs
Diffstat (limited to 'templates/note/reply_form.php')
| -rw-r--r-- | templates/note/reply_form.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/templates/note/reply_form.php b/templates/note/reply_form.php new file mode 100644 index 0000000..2d8cfc3 --- /dev/null +++ b/templates/note/reply_form.php @@ -0,0 +1,60 @@ +<?php +use Digitigrade\Model\NotePrivacyScope; +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"; + } +} + +$scopeOptions = match ($note->privacy->scope) { + NotePrivacyScope::NONE => ['none'], + NotePrivacyScope::MUTUALS => ['none', 'mutuals'], + NotePrivacyScope::FOLLOWERS => ['none', 'mutuals', 'followers'], + default => ['none', 'mutuals', 'followers', 'public'] +}; +$selectedScope = $note->privacy->scope->value; +?> +<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 summaryAndContent"> + <label for="replyContent-<?= $note->id ?>"><?= __('writeReply.label') ?></label> + <input type="text" id="replySummary-<?= $note->id ?>" name="summary" autocomplete="off" + value="<?= $summaryText ?>" placeholder="<?= __('writeNote.summary.label') ?>"> + <textarea id="replyContent-<?= $note->id ?>" name="content" required autocomplete="off" + placeholder="<?= __('writeReply.placeholder') ?>"></textarea> + <?php call_template('formatting_hint'); ?> + </div> + <details> + <summary><?= __('writeNote.moreOptions') ?></summary> + <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"> + <label for="replyScope-<?= $note->id ?>"><?= __('writeNote.scope.label') ?></label> + <select name="scope" id="replyScope-<?= $note->id ?>" required autocomplete="off"> + <?php foreach ($scopeOptions as $s): ?> + <option value="<?= $s ?>" <?= $selectedScope == $s ? 'selected' : '' ?>> + <?= __("note.privacy.scope.$s") ?> + </option> + <?php endforeach; ?> + </select> + </div> + </details> + <div class="row"> + <button class="primary"><?= __('writeReply.action') ?></button> + </div> +</form>
\ No newline at end of file |
