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/actor/atom.php | 51 +++++++++ templates/actor/avatar.php | 5 + templates/actor/profile.php | 83 ++++++++++++++ templates/actor/profile_block_button.php | 9 ++ templates/actor/profile_editable.php | 40 +++++++ templates/actor/profile_follow_button.php | 20 ++++ templates/actor/profile_page.php | 52 +++++++++ templates/actor/profile_pending_follow.php | 21 ++++ templates/actor/profile_reset_avatar.php | 3 + templates/actor/rss.php | 46 ++++++++ templates/actor_atom.php | 51 --------- templates/actor_avatar.php | 5 - templates/actor_profile.php | 83 -------------- templates/actor_profile_block_button.php | 9 -- templates/actor_profile_editable.php | 40 ------- templates/actor_profile_follow_button.php | 20 ---- templates/actor_profile_page.php | 52 --------- templates/actor_profile_pending_follow.php | 21 ---- templates/actor_profile_reset_avatar.php | 3 - templates/actor_rss.php | 46 -------- templates/attachment_pill.php | 44 -------- templates/follow_requests_page.php | 2 +- templates/left_side_navigation.php | 41 ------- templates/mobilepane_left.php | 6 +- templates/navigation/header_links.php | 12 ++ templates/navigation/left_side.php | 41 +++++++ templates/navigation/side_links.php | 13 +++ templates/navigation_links.php | 12 -- templates/note.php | 176 ----------------------------- 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 ++++++++ templates/note_attachment.php | 17 --- templates/note_link_preview.php | 23 ---- templates/note_page.php | 36 ------ templates/pages/list_item.php | 11 ++ templates/pages/list_page.php | 19 ++++ templates/pages/new_form.php | 26 +++++ templates/pages/new_page.php | 4 + templates/pages/page.php | 36 ++++++ templates/pages_list_item.php | 11 -- templates/pages_list_page.php | 19 ---- templates/pages_new_form.php | 26 ----- templates/pages_new_page.php | 4 - templates/reply_button.php | 13 --- templates/reply_form.php | 60 ---------- templates/side_navigation.php | 13 --- templates/skeleton.php | 10 +- templates/thread_page.php | 2 +- templates/write_note_form.php | 49 -------- 54 files changed, 884 insertions(+), 884 deletions(-) create mode 100644 templates/actor/atom.php create mode 100644 templates/actor/avatar.php create mode 100644 templates/actor/profile.php create mode 100644 templates/actor/profile_block_button.php create mode 100644 templates/actor/profile_editable.php create mode 100644 templates/actor/profile_follow_button.php create mode 100644 templates/actor/profile_page.php create mode 100644 templates/actor/profile_pending_follow.php create mode 100644 templates/actor/profile_reset_avatar.php create mode 100644 templates/actor/rss.php delete mode 100644 templates/actor_atom.php delete mode 100644 templates/actor_avatar.php delete mode 100644 templates/actor_profile.php delete mode 100644 templates/actor_profile_block_button.php delete mode 100644 templates/actor_profile_editable.php delete mode 100644 templates/actor_profile_follow_button.php delete mode 100644 templates/actor_profile_page.php delete mode 100644 templates/actor_profile_pending_follow.php delete mode 100644 templates/actor_profile_reset_avatar.php delete mode 100644 templates/actor_rss.php delete mode 100644 templates/attachment_pill.php delete mode 100644 templates/left_side_navigation.php create mode 100644 templates/navigation/header_links.php create mode 100644 templates/navigation/left_side.php create mode 100644 templates/navigation/side_links.php delete mode 100644 templates/navigation_links.php delete mode 100644 templates/note.php 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 delete mode 100644 templates/note_attachment.php delete mode 100644 templates/note_link_preview.php delete mode 100644 templates/note_page.php create mode 100644 templates/pages/list_item.php create mode 100644 templates/pages/list_page.php create mode 100644 templates/pages/new_form.php create mode 100644 templates/pages/new_page.php create mode 100644 templates/pages/page.php delete mode 100644 templates/pages_list_item.php delete mode 100644 templates/pages_list_page.php delete mode 100644 templates/pages_new_form.php delete mode 100644 templates/pages_new_page.php delete mode 100644 templates/reply_button.php delete mode 100644 templates/reply_form.php delete mode 100644 templates/side_navigation.php delete mode 100644 templates/write_note_form.php (limited to 'templates') diff --git a/templates/actor/atom.php b/templates/actor/atom.php new file mode 100644 index 0000000..8bd40fb --- /dev/null +++ b/templates/actor/atom.php @@ -0,0 +1,51 @@ +id/feed/$lang/feed.atom"); +$actorPage = path_to_uri("/@/$actor->handle"); + +echo ''; +?> + + + + <?= htmlspecialchars($actor->displayName) ?> — <?= GlobalSettings::getInstance()->get('instance.name') ?> + + created->format(DateTime::ATOM) ?> + + displayName) ?> + + + + + Digitigrade + avatar)): ?> + avatar ?> + + displayName) ?> + + + privacy->scope != NotePrivacyScope::PUBLIC || $note->inReplyTo != null) { + continue; + } + ?> + + id") ?> + <![CDATA[<?= htmlspecialchars(substr($note->plainContent, 0, 50), double_encode: false) ?>]]> + modified ?? $note->created)->format(DateTime::ATOM) ?> + handle/note/$note->id") ?>" /> + getBestContentAsHtml() ?>]]> + attachments as $file): ?> + + + + + \ No newline at end of file diff --git a/templates/actor/avatar.php b/templates/actor/avatar.php new file mode 100644 index 0000000..16b529b --- /dev/null +++ b/templates/actor/avatar.php @@ -0,0 +1,5 @@ +avatar)): ?> + + + + \ No newline at end of file diff --git a/templates/actor/profile.php b/templates/actor/profile.php new file mode 100644 index 0000000..be27c86 --- /dev/null +++ b/templates/actor/profile.php @@ -0,0 +1,83 @@ + +
+
+ + + + + $actor]); ?> + + + + +
+
displayName) ?>
+
pronouns) ?>
+
@getFullHandle() ?>
+
created->format('Y-m-d')) ?> +
+
+ +
+ + isLocal && isset($actor->homepage)): ?> +
  • + + + + +
  • + + getBool('profile.rssEnabled')): ?> + +
  • + id/feed/$lang/feed.rss" ?>" target="_blank" type="application/rss+xml"> + + + +
  • +
  • + id/feed/$lang/feed.atom" ?>" target="_blank" type="application/atom+xml"> + + + +
  • + + actor != $actor): ?> +
  • $user, 'actor' => $actor]) ?>
  • + + +
    + +
    + + bio) && $actor->bio != '') { ?> +
    bio) ?>
    + __('user.profile.bio.placeholder')]); + } ?> + + id != $user->actor->id): ?> +
    + followsPending($user->actor)) + call_template('actor/profile_pending_follow', ['subject' => $actor, 'object' => $user->actor]); ?> + follows($user->actor)): ?> + + + $actor, 'user' => $user]); ?> +
    + id == $user->actor->id): ?> +
    + +
    + + +
    \ No newline at end of file diff --git a/templates/actor/profile_block_button.php b/templates/actor/profile_block_button.php new file mode 100644 index 0000000..1b71613 --- /dev/null +++ b/templates/actor/profile_block_button.php @@ -0,0 +1,9 @@ +actor->blocks($actor); +$action = $blocks ? 'unblock' : 'block'; +?> + \ No newline at end of file diff --git a/templates/actor/profile_editable.php b/templates/actor/profile_editable.php new file mode 100644 index 0000000..fc969bd --- /dev/null +++ b/templates/actor/profile_editable.php @@ -0,0 +1,40 @@ +
    +
    + $actor]); ?> +
    +
    +
    + + +
    +
    + + +
    +
    +
    @getFullHandle() ?>
    +
    created->format('Y-m-d')) ?>
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + +
    +
    \ No newline at end of file diff --git a/templates/actor/profile_follow_button.php b/templates/actor/profile_follow_button.php new file mode 100644 index 0000000..e2b314d --- /dev/null +++ b/templates/actor/profile_follow_button.php @@ -0,0 +1,20 @@ +actor, $actor); +$state = match ($relation?->status) { + null => $actor->requestToFollow ? 'request' : 'normal', + FollowRelationStatus::PENDING => 'pending', + FollowRelationStatus::ACTIVE => 'active' +}; +?> + \ No newline at end of file diff --git a/templates/actor/profile_page.php b/templates/actor/profile_page.php new file mode 100644 index 0000000..9c11dd6 --- /dev/null +++ b/templates/actor/profile_page.php @@ -0,0 +1,52 @@ + "$actor->displayName - @" . $actor->getFullHandle(), + 'renderTitleHeading' => false, + 'ogTitle' => $actor->displayName, + 'ogDesc' => $actor->bio, + 'ogImage' => $actor->avatar ?? path_to_uri('/static/default-avatar.png'), + 'ogType' => 'profile', + 'ogHandle' => '@' . $actor->getFullHandle(true), + 'headLinks' => ($actorUser != null && (new UserSettings($actorUser))->getBool('profile.rssEnabled')) ? [ + [ + 'rel' => 'alternate', + 'type' => 'application/rss+xml', + 'href' => "/actor/$actor->id/feed/$lang/feed.rss", + 'title' => __('user.profile.feed.rss') + ], + [ + 'rel' => 'alternate', + 'type' => 'application/atom+xml', + 'href' => "/actor/$actor->id/feed/$lang/feed.atom", + 'title' => __('user.profile.feed.atom') + ] + ] : [] +], function () use ($actor) { + $user = UserAccount::findByCurrentSession(); + + call_template('actor/profile', ['actor' => $actor]); + echo '
    '; + $notes = Note::findAllWithAuthor($actor, 20); + if (count($notes) == 0) { + call_template('placeholder_text', ['message' => __('user.notes.placeholder')]); + } elseif ($user != null && $user->actor->blocks($actor)) { + call_template('placeholder_text', ['message' => __('user.profile.notesHidden')]); + } else { + foreach ($notes as $n) { + if ($n->isViewableBy($user)) + call_template('note/note', ['note' => $n]); + } + $countNotShown = Note::countWithAuthor($actor) - count($notes); + if ($countNotShown >= 0) { + call_template('placeholder_text', ['count' => $countNotShown]); + } + } +}); \ No newline at end of file diff --git a/templates/actor/profile_pending_follow.php b/templates/actor/profile_pending_follow.php new file mode 100644 index 0000000..2f49fcd --- /dev/null +++ b/templates/actor/profile_pending_follow.php @@ -0,0 +1,21 @@ + + +
    + +
    + + + +
    + + + +
    + + \ No newline at end of file diff --git a/templates/actor/profile_reset_avatar.php b/templates/actor/profile_reset_avatar.php new file mode 100644 index 0000000..86a3507 --- /dev/null +++ b/templates/actor/profile_reset_avatar.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/templates/actor/rss.php b/templates/actor/rss.php new file mode 100644 index 0000000..03fc4f5 --- /dev/null +++ b/templates/actor/rss.php @@ -0,0 +1,46 @@ +'; +?> + + + + <?= htmlspecialchars($actor->displayName) ?> — <?= GlobalSettings::getInstance()->get('instance.name') ?> + + handle") ?> + displayName)) ?> + + + avatar)): ?> + + avatar ?> + + + + privacy->scope != NotePrivacyScope::PUBLIC || $note->inReplyTo != null) { + continue; + } + ?> + + handle/note/$note->id") ?> + id") ?> + <![CDATA[<?= htmlspecialchars(substr($note->plainContent, 0, 50), double_encode: false) ?>]]> + getBestContentAsHtml() ?>]]> + created->format(DateTime::RSS) ?> + attachments as $file): ?> + + + + + + \ No newline at end of file diff --git a/templates/actor_atom.php b/templates/actor_atom.php deleted file mode 100644 index 8bd40fb..0000000 --- a/templates/actor_atom.php +++ /dev/null @@ -1,51 +0,0 @@ -id/feed/$lang/feed.atom"); -$actorPage = path_to_uri("/@/$actor->handle"); - -echo ''; -?> - - - - <?= htmlspecialchars($actor->displayName) ?> — <?= GlobalSettings::getInstance()->get('instance.name') ?> - - created->format(DateTime::ATOM) ?> - - displayName) ?> - - - - - Digitigrade - avatar)): ?> - avatar ?> - - displayName) ?> - - - privacy->scope != NotePrivacyScope::PUBLIC || $note->inReplyTo != null) { - continue; - } - ?> - - id") ?> - <![CDATA[<?= htmlspecialchars(substr($note->plainContent, 0, 50), double_encode: false) ?>]]> - modified ?? $note->created)->format(DateTime::ATOM) ?> - handle/note/$note->id") ?>" /> - getBestContentAsHtml() ?>]]> - attachments as $file): ?> - - - - - \ No newline at end of file diff --git a/templates/actor_avatar.php b/templates/actor_avatar.php deleted file mode 100644 index 16b529b..0000000 --- a/templates/actor_avatar.php +++ /dev/null @@ -1,5 +0,0 @@ -avatar)): ?> - - - - \ No newline at end of file diff --git a/templates/actor_profile.php b/templates/actor_profile.php deleted file mode 100644 index dfb0174..0000000 --- a/templates/actor_profile.php +++ /dev/null @@ -1,83 +0,0 @@ - -
    -
    - - - - - $actor]); ?> - - - - -
    -
    displayName) ?>
    -
    pronouns) ?>
    -
    @getFullHandle() ?>
    -
    created->format('Y-m-d')) ?> -
    -
    - -
    - - isLocal && isset($actor->homepage)): ?> -
  • - - - - -
  • - - getBool('profile.rssEnabled')): ?> - -
  • - id/feed/$lang/feed.rss" ?>" target="_blank" type="application/rss+xml"> - - - -
  • -
  • - id/feed/$lang/feed.atom" ?>" target="_blank" type="application/atom+xml"> - - - -
  • - - actor != $actor): ?> -
  • $user, 'actor' => $actor]) ?>
  • - - -
    - -
    - - bio) && $actor->bio != '') { ?> -
    bio) ?>
    - __('user.profile.bio.placeholder')]); - } ?> - - id != $user->actor->id): ?> -
    - followsPending($user->actor)) - call_template('actor_profile_pending_follow', ['subject' => $actor, 'object' => $user->actor]); ?> - follows($user->actor)): ?> - - - $actor, 'user' => $user]); ?> -
    - id == $user->actor->id): ?> -
    - -
    - - -
    \ No newline at end of file diff --git a/templates/actor_profile_block_button.php b/templates/actor_profile_block_button.php deleted file mode 100644 index 1b71613..0000000 --- a/templates/actor_profile_block_button.php +++ /dev/null @@ -1,9 +0,0 @@ -actor->blocks($actor); -$action = $blocks ? 'unblock' : 'block'; -?> - \ No newline at end of file diff --git a/templates/actor_profile_editable.php b/templates/actor_profile_editable.php deleted file mode 100644 index 6ff5d8c..0000000 --- a/templates/actor_profile_editable.php +++ /dev/null @@ -1,40 +0,0 @@ -
    -
    - $actor]); ?> -
    -
    -
    - - -
    -
    - - -
    -
    -
    @getFullHandle() ?>
    -
    created->format('Y-m-d')) ?>
    -
    -
    - -
    - - - -
    - -
    - - -
    - -
    - - -
    -
    \ No newline at end of file diff --git a/templates/actor_profile_follow_button.php b/templates/actor_profile_follow_button.php deleted file mode 100644 index e2b314d..0000000 --- a/templates/actor_profile_follow_button.php +++ /dev/null @@ -1,20 +0,0 @@ -actor, $actor); -$state = match ($relation?->status) { - null => $actor->requestToFollow ? 'request' : 'normal', - FollowRelationStatus::PENDING => 'pending', - FollowRelationStatus::ACTIVE => 'active' -}; -?> - \ No newline at end of file diff --git a/templates/actor_profile_page.php b/templates/actor_profile_page.php deleted file mode 100644 index 1b2981d..0000000 --- a/templates/actor_profile_page.php +++ /dev/null @@ -1,52 +0,0 @@ - "$actor->displayName - @" . $actor->getFullHandle(), - 'renderTitleHeading' => false, - 'ogTitle' => $actor->displayName, - 'ogDesc' => $actor->bio, - 'ogImage' => $actor->avatar ?? path_to_uri('/static/default-avatar.png'), - 'ogType' => 'profile', - 'ogHandle' => '@' . $actor->getFullHandle(true), - 'headLinks' => ($actorUser != null && (new UserSettings($actorUser))->getBool('profile.rssEnabled')) ? [ - [ - 'rel' => 'alternate', - 'type' => 'application/rss+xml', - 'href' => "/actor/$actor->id/feed/$lang/feed.rss", - 'title' => __('user.profile.feed.rss') - ], - [ - 'rel' => 'alternate', - 'type' => 'application/atom+xml', - 'href' => "/actor/$actor->id/feed/$lang/feed.atom", - 'title' => __('user.profile.feed.atom') - ] - ] : [] -], function () use ($actor) { - $user = UserAccount::findByCurrentSession(); - - call_template('actor_profile', ['actor' => $actor]); - echo '
    '; - $notes = Note::findAllWithAuthor($actor, 20); - if (count($notes) == 0) { - call_template('placeholder_text', ['message' => __('user.notes.placeholder')]); - } elseif ($user != null && $user->actor->blocks($actor)) { - call_template('placeholder_text', ['message' => __('user.profile.notesHidden')]); - } else { - foreach ($notes as $n) { - if ($n->isViewableBy($user)) - call_template('note', ['note' => $n]); - } - $countNotShown = Note::countWithAuthor($actor) - count($notes); - if ($countNotShown >= 0) { - call_template('placeholder_text', ['count' => $countNotShown]); - } - } -}); \ No newline at end of file diff --git a/templates/actor_profile_pending_follow.php b/templates/actor_profile_pending_follow.php deleted file mode 100644 index 2f49fcd..0000000 --- a/templates/actor_profile_pending_follow.php +++ /dev/null @@ -1,21 +0,0 @@ - - -
    - -
    - - - -
    - - - -
    - - \ No newline at end of file diff --git a/templates/actor_profile_reset_avatar.php b/templates/actor_profile_reset_avatar.php deleted file mode 100644 index 86a3507..0000000 --- a/templates/actor_profile_reset_avatar.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/templates/actor_rss.php b/templates/actor_rss.php deleted file mode 100644 index 03fc4f5..0000000 --- a/templates/actor_rss.php +++ /dev/null @@ -1,46 +0,0 @@ -'; -?> - - - - <?= htmlspecialchars($actor->displayName) ?> — <?= GlobalSettings::getInstance()->get('instance.name') ?> - - handle") ?> - displayName)) ?> - - - avatar)): ?> - - avatar ?> - - - - privacy->scope != NotePrivacyScope::PUBLIC || $note->inReplyTo != null) { - continue; - } - ?> - - handle/note/$note->id") ?> - id") ?> - <![CDATA[<?= htmlspecialchars(substr($note->plainContent, 0, 50), double_encode: false) ?>]]> - getBestContentAsHtml() ?>]]> - created->format(DateTime::RSS) ?> - attachments as $file): ?> - - - - - - \ No newline at end of file diff --git a/templates/attachment_pill.php b/templates/attachment_pill.php deleted file mode 100644 index 6fff74d..0000000 --- a/templates/attachment_pill.php +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - -
    -
    - - -
    - - -
    - - -
    -
    - -
    -
    - - \ No newline at end of file diff --git a/templates/follow_requests_page.php b/templates/follow_requests_page.php index f93601c..beb26d5 100644 --- a/templates/follow_requests_page.php +++ b/templates/follow_requests_page.php @@ -4,6 +4,6 @@ call_template('placeholder_text'); } foreach ($actors as $actor) { - call_template('actor_profile', ['actor' => $actor, 'addLink' => true]); + call_template('actor/profile', ['actor' => $actor, 'addLink' => true]); } }); \ No newline at end of file diff --git a/templates/left_side_navigation.php b/templates/left_side_navigation.php deleted file mode 100644 index 5d7f368..0000000 --- a/templates/left_side_navigation.php +++ /dev/null @@ -1,41 +0,0 @@ - '/followrequests', - 'icon' => 'person-add-outline', - 'label' => __('navigation.followRequests'), - 'unreadCount' => FollowRelation::countWhere("object = ? AND status = 'pending'", [$user->actor->id]) - ], [ - 'href' => '/pages', - 'icon' => 'article-outline', - 'label' => __('note.page.list.pageTitle') - ], [ - 'href' => '/preferences', - 'icon' => 'tune', - 'label' => __('preferences.pageTitle') - ]]; - if ($user->isAdmin) { - $links[] = ['href' => '/admin/settings/instance', 'icon' => 'settings-outline', 'label' => __('navigation.instanceSettings')]; - } -} -$links[] = [ - 'href' => '/about', - 'icon' => 'info-outline', - 'label' => __('about.pageTitle') -]; -if ($user != null) { - $links[] = [ - 'href' => '/logout', - 'icon' => 'logout', - 'label' => __('navigation.logout'), - 'confirmation' => __('navigation.logout.confirmation') - ]; -} - -call_template('side_navigation', ['links' => $links]); diff --git a/templates/mobilepane_left.php b/templates/mobilepane_left.php index 753383a..29be318 100644 --- a/templates/mobilepane_left.php +++ b/templates/mobilepane_left.php @@ -31,10 +31,10 @@ $settings = GlobalSettings::getInstance(); '/feed/global' => __('timeline.global.shortName'), '/feed/local' => __('timeline.local.shortName'), ]; - call_template('navigation_links', ['links' => $links]); + call_template('navigation/header_links', ['links' => $links]); - call_template('write_note_form', ['actor' => $user->actor]); - call_template('left_side_navigation'); + call_template('note/write_form', ['actor' => $user->actor]); + call_template('navigation/left_side'); ?>

    diff --git a/templates/navigation/header_links.php b/templates/navigation/header_links.php new file mode 100644 index 0000000..1540491 --- /dev/null +++ b/templates/navigation/header_links.php @@ -0,0 +1,12 @@ + + \ No newline at end of file diff --git a/templates/navigation/left_side.php b/templates/navigation/left_side.php new file mode 100644 index 0000000..219e7a1 --- /dev/null +++ b/templates/navigation/left_side.php @@ -0,0 +1,41 @@ + '/followrequests', + 'icon' => 'person-add-outline', + 'label' => __('navigation.followRequests'), + 'unreadCount' => FollowRelation::countWhere("object = ? AND status = 'pending'", [$user->actor->id]) + ], [ + 'href' => '/pages', + 'icon' => 'article-outline', + 'label' => __('note.page.list.pageTitle') + ], [ + 'href' => '/preferences', + 'icon' => 'tune', + 'label' => __('preferences.pageTitle') + ]]; + if ($user->isAdmin) { + $links[] = ['href' => '/admin/settings/instance', 'icon' => 'settings-outline', 'label' => __('navigation.instanceSettings')]; + } +} +$links[] = [ + 'href' => '/about', + 'icon' => 'info-outline', + 'label' => __('about.pageTitle') +]; +if ($user != null) { + $links[] = [ + 'href' => '/logout', + 'icon' => 'logout', + 'label' => __('navigation.logout'), + 'confirmation' => __('navigation.logout.confirmation') + ]; +} + +call_template('navigation/side_links', ['links' => $links]); diff --git a/templates/navigation/side_links.php b/templates/navigation/side_links.php new file mode 100644 index 0000000..94bff5e --- /dev/null +++ b/templates/navigation/side_links.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/templates/navigation_links.php b/templates/navigation_links.php deleted file mode 100644 index 1540491..0000000 --- a/templates/navigation_links.php +++ /dev/null @@ -1,12 +0,0 @@ - - \ No newline at end of file diff --git a/templates/note.php b/templates/note.php deleted file mode 100644 index c80eace..0000000 --- a/templates/note.php +++ /dev/null @@ -1,176 +0,0 @@ -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('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/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 diff --git a/templates/note_attachment.php b/templates/note_attachment.php deleted file mode 100644 index c139a00..0000000 --- a/templates/note_attachment.php +++ /dev/null @@ -1,17 +0,0 @@ -href); -if (!$attachment->isImage() && $attachment->description) { - $filename = $attachment->description; -} -?> -
    - isImage()): ?> - <?= htmlspecialchars($attachment->description ?? '') ?> - - - - - - -
    \ No newline at end of file diff --git a/templates/note_link_preview.php b/templates/note_link_preview.php deleted file mode 100644 index 1525642..0000000 --- a/templates/note_link_preview.php +++ /dev/null @@ -1,23 +0,0 @@ -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_page.php b/templates/note_page.php deleted file mode 100644 index 647c64e..0000000 --- a/templates/note_page.php +++ /dev/null @@ -1,36 +0,0 @@ -getPage(); - -call_template('skeleton', ['pageTitle' => $page->title, 'renderTitleHeading' => false], function () use ($note, $page) { ?> -
    -
    -

    title) ?>

    - - $note->author]); ?> - ' . htmlspecialchars($note->author->displayName) . '' - ) ?> - -
    - created)) ?> -
    - modified) && $note->modified != $note->created): ?> -
    - modified)) ?> -
    - -
    -
    - getBestContentAsHtml() ?> -
    -
    -
    -getPage(); +?> + + $note->author]) ?> +
    +
    title) ?>
    +
    author->displayName) ?>
    +
    +
    \ No newline at end of file diff --git a/templates/pages/list_page.php b/templates/pages/list_page.php new file mode 100644 index 0000000..e347e18 --- /dev/null +++ b/templates/pages/list_page.php @@ -0,0 +1,19 @@ + __('note.page.list.pageTitle')], function () { + ?> + + $note]); + } + if (count($notes) == 0) { + call_template('placeholder_text'); + } else { + call_template('placeholder_text', ['count' => Note::countWithExtension(Note::EXTENSION_PAGES) - count($notes)]); + } +}); \ No newline at end of file diff --git a/templates/pages/new_form.php b/templates/pages/new_form.php new file mode 100644 index 0000000..a8dde16 --- /dev/null +++ b/templates/pages/new_form.php @@ -0,0 +1,26 @@ +
    +
    + + +
    + +
    + + + +
    + +
    + + +
    + +
    + +
    +
    \ No newline at end of file diff --git a/templates/pages/new_page.php b/templates/pages/new_page.php new file mode 100644 index 0000000..9bb44b4 --- /dev/null +++ b/templates/pages/new_page.php @@ -0,0 +1,4 @@ + __('note.page.new.pageTitle')], function () { + call_template('pages/new_form'); +}); \ No newline at end of file diff --git a/templates/pages/page.php b/templates/pages/page.php new file mode 100644 index 0000000..bc17664 --- /dev/null +++ b/templates/pages/page.php @@ -0,0 +1,36 @@ +getPage(); + +call_template('skeleton', ['pageTitle' => $page->title, 'renderTitleHeading' => false], function () use ($note, $page) { ?> +
    +
    +

    title) ?>

    + + $note->author]); ?> + ' . htmlspecialchars($note->author->displayName) . '' + ) ?> + +
    + created)) ?> +
    + modified) && $note->modified != $note->created): ?> +
    + modified)) ?> +
    + +
    +
    + getBestContentAsHtml() ?> +
    +
    +
    +getPage(); -?> - - $note->author]) ?> -
    -
    title) ?>
    -
    author->displayName) ?>
    -
    -
    \ No newline at end of file diff --git a/templates/pages_list_page.php b/templates/pages_list_page.php deleted file mode 100644 index 2dd1af2..0000000 --- a/templates/pages_list_page.php +++ /dev/null @@ -1,19 +0,0 @@ - __('note.page.list.pageTitle')], function () { - ?> - - $note]); - } - if (count($notes) == 0) { - call_template('placeholder_text'); - } else { - call_template('placeholder_text', ['count' => Note::countWithExtension(Note::EXTENSION_PAGES) - count($notes)]); - } -}); \ No newline at end of file diff --git a/templates/pages_new_form.php b/templates/pages_new_form.php deleted file mode 100644 index a8dde16..0000000 --- a/templates/pages_new_form.php +++ /dev/null @@ -1,26 +0,0 @@ -
    -
    - - -
    - -
    - - - -
    - -
    - - -
    - -
    - -
    -
    \ No newline at end of file diff --git a/templates/pages_new_page.php b/templates/pages_new_page.php deleted file mode 100644 index e047b99..0000000 --- a/templates/pages_new_page.php +++ /dev/null @@ -1,4 +0,0 @@ - __('note.page.new.pageTitle')], function () { - call_template('pages_new_form'); -}); \ No newline at end of file diff --git a/templates/reply_button.php b/templates/reply_button.php deleted file mode 100644 index dadc121..0000000 --- a/templates/reply_button.php +++ /dev/null @@ -1,13 +0,0 @@ -inReplyTo == null ? 'reply' : 'reply-all'; -$id = "interactButton-reply-$note->id"; -?> -
    - - -
    \ No newline at end of file diff --git a/templates/reply_form.php b/templates/reply_form.php deleted file mode 100644 index 2d8cfc3..0000000 --- a/templates/reply_form.php +++ /dev/null @@ -1,60 +0,0 @@ -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/side_navigation.php b/templates/side_navigation.php deleted file mode 100644 index 94bff5e..0000000 --- a/templates/side_navigation.php +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/templates/skeleton.php b/templates/skeleton.php index 5848054..62090bd 100644 --- a/templates/skeleton.php +++ b/templates/skeleton.php @@ -53,7 +53,7 @@ $settings = GlobalSettings::getInstance(); '/feed/global' => __('timeline.global.shortName'), '/feed/local' => __('timeline.local.shortName'), ]); - call_template('navigation_links', ['links' => $links]); + call_template('navigation/header_links', ['links' => $links]); ?> get('instance.name') ?> @@ -63,12 +63,12 @@ $settings = GlobalSettings::getInstance(); [ + call_template('navigation/header_links', ['links' => [ '/login' => __('navigation.login') ]]); else: ?> - $user->actor]) ?> + $user->actor]) ?> actor->displayName) ?> @@ -79,9 +79,9 @@ $settings = GlobalSettings::getInstance();
    $user->actor]); + call_template('note/write_form', ['actor' => $user->actor]); } - call_template('left_side_navigation'); + call_template('navigation/left_side'); ?>

    diff --git a/templates/thread_page.php b/templates/thread_page.php index 5237f6c..ac2e640 100644 --- a/templates/thread_page.php +++ b/templates/thread_page.php @@ -17,7 +17,7 @@ call_template('skeleton', [ $user = UserAccount::findByCurrentSession(); foreach ($notes as $n) { if (!($user != null && $user->actor->blocks($n->author)) && $n->isViewableBy($user)) { - call_template('note', ['note' => $n, 'selected' => $n == $targetNote]); + call_template('note/note', ['note' => $n, 'selected' => $n == $targetNote]); } } }); \ No newline at end of file diff --git a/templates/write_note_form.php b/templates/write_note_form.php deleted file mode 100644 index 394f7ba..0000000 --- a/templates/write_note_form.php +++ /dev/null @@ -1,49 +0,0 @@ - - -
    > -
    - - $actor]); ?> - -
    - displayName) ?> -
    @handle ?>
    -
    -
    -
    - - - - -
    -
    - -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    - -
    -
    \ No newline at end of file -- cgit v1.3