From e0588a6113ff6b3c1000fa6c82629f81fb5e05b5 Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 15 Mar 2025 18:53:29 +0000 Subject: [refactor] move some templates to subdirs --- templates/note/attachment.php | 17 ++++ templates/note/attachment_pill.php | 44 ++++++++++ templates/note/link_preview.php | 23 +++++ templates/note/note.php | 176 +++++++++++++++++++++++++++++++++++++ templates/note/reply_button.php | 13 +++ templates/note/reply_form.php | 60 +++++++++++++ templates/note/write_form.php | 49 +++++++++++ 7 files changed, 382 insertions(+) create mode 100644 templates/note/attachment.php create mode 100644 templates/note/attachment_pill.php create mode 100644 templates/note/link_preview.php create mode 100644 templates/note/note.php create mode 100644 templates/note/reply_button.php create mode 100644 templates/note/reply_form.php create mode 100644 templates/note/write_form.php (limited to 'templates/note') diff --git a/templates/note/attachment.php b/templates/note/attachment.php new file mode 100644 index 0000000..c139a00 --- /dev/null +++ b/templates/note/attachment.php @@ -0,0 +1,17 @@ +href); +if (!$attachment->isImage() && $attachment->description) { + $filename = $attachment->description; +} +?> +
+ isImage()): ?> + <?= htmlspecialchars($attachment->description ?? '') ?> + + + + + + +
\ No newline at end of file diff --git a/templates/note/attachment_pill.php b/templates/note/attachment_pill.php new file mode 100644 index 0000000..6fff74d --- /dev/null +++ b/templates/note/attachment_pill.php @@ -0,0 +1,44 @@ + + + + + + + + + + + + +
+
+ + +
+ + +
+ + +
+
+ +
+
+ + \ No newline at end of file diff --git a/templates/note/link_preview.php b/templates/note/link_preview.php new file mode 100644 index 0000000..1525642 --- /dev/null +++ b/templates/note/link_preview.php @@ -0,0 +1,23 @@ +url); +if ($preview->siteName != $siteName) { + $siteName = htmlspecialchars($preview->siteName) . ' — ' . $siteName; +} +?> + + + + style == 'text' || !isset($preview->imageUrl)): ?> +
+ + + + +
+ + title) ?> + description) ?> +
+ +
\ No newline at end of file diff --git a/templates/note/note.php b/templates/note/note.php new file mode 100644 index 0000000..7cef342 --- /dev/null +++ b/templates/note/note.php @@ -0,0 +1,176 @@ +getInteractionsWithAuthor($user->actor); + $interKinds = array_map(fn($inter) => $inter->kind, $interactions); +} +$pathToSelf = $note->getLocalUiHref(); +?> +
+ + + $note->author]); ?> + + +
+ +
+ author->displayName) ?> + + author->pronouns) && trim($note->author->pronouns) != '') { + echo htmlspecialchars($note->author->pronouns); + } ?> + + + created) + . (isset($note->modified) && $note->modified != $note->created + ? ' (' . format_datetime($note->modified) . ')' + : '' + ) ?> + + +
+ + inReplyTo)): ?> + + mentions) > 0): ?> +
+ + + '' . htmlspecialchars($m->displayName) . '', + $note->mentions + ))) ?> + +
+ + + summary)): ?> +
+ summary) ?> + +
+ hasPage()): ?> + getPage()->title)) ?> + + getBestContentAsHtml() ?> + +
+ + attachments) > 0): ?> +
+ attachments as $attachment) { + call_template('note/attachment', ['attachment' => $attachment]); + } ?> +
+ + + getLinkPreviews() as $preview) { + call_template('note/link_preview', ['preview' => $preview]); + if (++$i > $MAX_PREVIEW_CARDS) + break; + } + ?> + + summary)): ?> +
+ + + hasPage()): ?> + + + + + + +
+ $action, + 'note' => $note, + 'active' => in_array($kind, $interKinds), + 'count' => $note->countInteractionsOfKind($kind), + 'disabled' => $actionsDisabled + ]); + } + call_template('note/reply_button', [ + 'note' => $note, + 'count' => $note->countReplies(), + 'disabled' => $actionsDisabled + ]); + ?> +
+ +
  • + +
  • + author->isLocal && ($note->author == $user?->actor || $user?->isAdmin)): ?> +
  • + +
  • + + author->isLocal): ?> +
  • + + + + +
  • + + +
    +
    + + $note]); ?> +
    +
    \ No newline at end of file diff --git a/templates/note/reply_button.php b/templates/note/reply_button.php new file mode 100644 index 0000000..dadc121 --- /dev/null +++ b/templates/note/reply_button.php @@ -0,0 +1,13 @@ +inReplyTo == null ? 'reply' : 'reply-all'; +$id = "interactButton-reply-$note->id"; +?> +
    + + +
    \ No newline at end of file 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 @@ +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; +?> + \ No newline at end of file diff --git a/templates/note/write_form.php b/templates/note/write_form.php new file mode 100644 index 0000000..add00ec --- /dev/null +++ b/templates/note/write_form.php @@ -0,0 +1,49 @@ + + +
    > +
    + + $actor]); ?> + +
    + displayName) ?> +
    @handle ?>
    +
    +
    +
    + + + + +
    +
    + +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    + +
    +
    \ No newline at end of file -- cgit v1.3