aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/note.php15
-rw-r--r--templates/reply_button.php2
-rw-r--r--templates/reply_form.php11
-rw-r--r--templates/skeleton.php1
-rw-r--r--templates/write_note_form.php2
5 files changed, 28 insertions, 3 deletions
diff --git a/templates/note.php b/templates/note.php
index fdc0dc8..3fc86ba 100644
--- a/templates/note.php
+++ b/templates/note.php
@@ -27,17 +27,28 @@ if ($user != null) {
?>
</a>
</div>
+ <?php if (isset($note->inReplyTo)): ?>
+ <div class="replyInfo">
+ <a href="/@/<?= $note->inReplyTo->author->getFullHandle() ?>/note/<?= $note->inReplyTo->id ?>">
+ <?= sprintf(__('note.info.replyTo'),
+ '<b>' . $note->inReplyTo->author->displayName) . '</b>' ?>
+ </a>
+ </div>
+ <?php endif; ?>
<div class="content">
<?= $note->getFormattedContent('text/html') ?? htmlspecialchars($note->plainContent) ?>
</div>
<div class="buttons">
<?php foreach (['like', 'dislike', 'reshare'] as $action) {
- render_template('interaction_button', [
+ call_template('interaction_button', [
'action' => $action,
'note' => $note,
'active' => in_array(InteractionKind::from($action), $interKinds)
]);
- } ?>
+ }
+ call_template('reply_button', ['note' => $note]);
+ ?>
</div>
+ <?php call_template('reply_form', ['note' => $note]); ?>
</div>
</article> \ No newline at end of file
diff --git a/templates/reply_button.php b/templates/reply_button.php
new file mode 100644
index 0000000..6b755df
--- /dev/null
+++ b/templates/reply_button.php
@@ -0,0 +1,2 @@
+<button title="<?= __('note.action.reply') ?>" class="icon material-symbols-outlined reply"
+ _="on click send toggle to [me, next .noteReplyForm] on toggle toggle .active">reply</button> \ No newline at end of file
diff --git a/templates/reply_form.php b/templates/reply_form.php
new file mode 100644
index 0000000..84d8121
--- /dev/null
+++ b/templates/reply_form.php
@@ -0,0 +1,11 @@
+<form class="noteReplyForm" id="replyForm-<?= $note->id ?>"
+ _="on submit send toggle to previous <button.reply/> 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></textarea>
+ </div>
+ <div class="row">
+ <button><?= __('writeReply.action') ?></button>
+ </div>
+</form> \ No newline at end of file
diff --git a/templates/skeleton.php b/templates/skeleton.php
index 072f812..e678957 100644
--- a/templates/skeleton.php
+++ b/templates/skeleton.php
@@ -11,6 +11,7 @@ $user = Digitigrade\Model\UserAccount::findByCurrentSession();
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
+ <script src="https://unpkg.com/hyperscript.org@0.9.13"></script>
<script src="/static/language-switch.js" defer></script>
</head>
diff --git a/templates/write_note_form.php b/templates/write_note_form.php
index 49fcafc..38a9993 100644
--- a/templates/write_note_form.php
+++ b/templates/write_note_form.php
@@ -1,7 +1,7 @@
<form action="/todo" method="post" hx-post="/fragment/note" hx-swap="outerHTML" hx-disabled-elt="find button">
<div class="row">
<label for="noteContent"><?= __('writeNote.label') ?></label>
- <textarea name="content" id="noteContent"></textarea>
+ <textarea name="content" id="noteContent" required></textarea>
</div>
<div class="row">
<button><?= __('writeNote.action') ?></button>