diff options
Diffstat (limited to 'templates/pages/page_item.php')
| -rw-r--r-- | templates/pages/page_item.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/templates/pages/page_item.php b/templates/pages/page_item.php new file mode 100644 index 0000000..201a2f9 --- /dev/null +++ b/templates/pages/page_item.php @@ -0,0 +1,55 @@ +<?php + +use Digitigrade\Model\UserAccount; + +/** @var \Digitigrade\Model\Note $note */ +/** @var \Digitigrade\Page $page */ + +?> +<article lang="<?= htmlspecialchars($note->language) ?>"> + <div class="pageHeader"> + <div> + <h1><?= htmlspecialchars($page->title) ?></h1> + <a class="pageAuthor" href="/@/<?= htmlspecialchars($note->author->getFullHandle()) ?>"> + <?php call_template('actor/avatar', ['actor' => $note->author]); ?> + <span><?= __f( + 'note.page.author', + '<span class="displayName">' . htmlspecialchars($note->author->displayName) . '</span>' + ) ?></span> + </a> + <div class="created"> + <?= __f('note.page.created', format_datetime($note->created)) ?> + </div> + <?php if (isset($note->modified) && $note->modified != $note->created): ?> + <div class="modified"> + <?= __f('note.page.modified', format_datetime($note->modified)) ?> + </div> + <?php endif; ?> + </div> + <div class="pageActions"> + <?php call_template('menu_button', [], function () use ($note, $page) { + $user = UserAccount::findByCurrentSession(); + if ($note->author->isLocal && ($note->author == $user?->actor || $user?->isAdmin)) { ?> + <li> + <button hx-get="/fragment/page/<?= $note->id ?>/edit" hx-target="closest article" hx-swap="outerHTML"> + <span class="material-symbols edit-outline"></span> + <span><?= __('note.action.edit') ?></span> + </button> + </li> + <li> + <button hx-delete="/fragment/note/<?= $note->id ?>" + hx-confirm="<?= __('note.action.delete.confirmation') ?>" hx-target="closest article" + hx-swap="delete" _="on htmx:afterOnLoad go back"> + <span class="material-symbols delete-outline"></span> + <span><?= __('note.action.delete') ?></span> + </button> + </li> + <?php } + }); ?> + </div> + </div> + <hr> + <div class="pageContent"> + <?= $page->getBestContentAsHtml() ?> + </div> +</article>
\ No newline at end of file |
