From 61b122e88cc6783b4d0cf5142a22002f8e558c60 Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 15 Mar 2025 18:35:59 +0000 Subject: implement pages --- templates/formatting_hint.php | 5 +++++ templates/left_side_navigation.php | 4 ++++ templates/note.php | 19 +++++++++++++++---- 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/reply_form.php | 6 +----- templates/write_note_form.php | 6 +----- 10 files changed, 122 insertions(+), 14 deletions(-) create mode 100644 templates/formatting_hint.php create 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 (limited to 'templates') diff --git a/templates/formatting_hint.php b/templates/formatting_hint.php new file mode 100644 index 0000000..e7163ac --- /dev/null +++ b/templates/formatting_hint.php @@ -0,0 +1,5 @@ + + + ' . __('writeNote.formattingHint.markdown') . '') ?> + \ No newline at end of file diff --git a/templates/left_side_navigation.php b/templates/left_side_navigation.php index 4cf8b55..5d7f368 100644 --- a/templates/left_side_navigation.php +++ b/templates/left_side_navigation.php @@ -11,6 +11,10 @@ if ($user != null) { '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', diff --git a/templates/note.php b/templates/note.php index 759a7c7..c80eace 100644 --- a/templates/note.php +++ b/templates/note.php @@ -17,7 +17,7 @@ if ($user != null) { $interactions = $note->getInteractionsWithAuthor($user->actor); $interKinds = array_map(fn($inter) => $inter->kind, $interactions); } -$pathToSelf = '/@/' . $note->author->getFullHandle() . '/note/' . $note->id; +$pathToSelf = $note->getLocalUiHref(); ?>
@@ -36,9 +36,9 @@ $pathToSelf = '/@/' . $note->author->getFullHandle() . '/note/' . $note->id; } ?> - created, $prefs?->get('locale.timezone')) + created) . (isset($note->modified) && $note->modified != $note->created - ? ' (' . format_datetime($note->modified, $prefs?->get('locale.timezone')) . ')' + ? ' (' . format_datetime($note->modified) . ')' : '' ) ?> @@ -81,7 +81,11 @@ $pathToSelf = '/@/' . $note->author->getFullHandle() . '/note/' . $note->id; summary) ?>
- getBestContentAsHtml() ?> + hasPage()): ?> + getPage()->title)) ?> + + getBestContentAsHtml() ?> +
attachments) > 0): ?> @@ -105,6 +109,13 @@ $pathToSelf = '/@/' . $note->author->getFullHandle() . '/note/' . $note->id; + hasPage()): ?> + + + + + +
getPage(); + +call_template('skeleton', ['pageTitle' => $page->title, 'renderTitleHeading' => false], function () use ($note, $page) { ?> +
+ +
+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..2dd1af2 --- /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..e047b99 --- /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/reply_form.php b/templates/reply_form.php index 59d2d53..2d8cfc3 100644 --- a/templates/reply_form.php +++ b/templates/reply_form.php @@ -30,11 +30,7 @@ $selectedScope = $note->privacy->scope->value; value="" placeholder=""> - - - ' . __('writeNote.formattingHint.markdown') . '') ?> - +
diff --git a/templates/write_note_form.php b/templates/write_note_form.php index 1062a27..394f7ba 100644 --- a/templates/write_note_form.php +++ b/templates/write_note_form.php @@ -21,11 +21,7 @@ placeholder=""> - - - ' . __('writeNote.formattingHint.markdown') . '') ?> - +
-- cgit v1.3