diff options
Diffstat (limited to 'templates/pages')
| -rw-r--r-- | templates/pages/list_item.php | 11 | ||||
| -rw-r--r-- | templates/pages/list_page.php | 19 | ||||
| -rw-r--r-- | templates/pages/new_form.php | 26 | ||||
| -rw-r--r-- | templates/pages/new_page.php | 4 | ||||
| -rw-r--r-- | templates/pages/page.php | 36 |
5 files changed, 96 insertions, 0 deletions
diff --git a/templates/pages/list_item.php b/templates/pages/list_item.php new file mode 100644 index 0000000..3d4d2e2 --- /dev/null +++ b/templates/pages/list_item.php @@ -0,0 +1,11 @@ +<?php +/** @var \Digitigrade\Model\Note $note */ +$page = $note->getPage(); +?> +<a class="pageItem" href="<?= htmlspecialchars($note->getLocalUiHref(true)) ?>"> + <?= call_template('actor/avatar', ['actor' => $note->author]) ?> + <div> + <div class="title"><?= htmlspecialchars($page->title) ?></div> + <div class="author"><?= htmlspecialchars($note->author->displayName) ?></div> + </div> +</a>
\ 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 @@ +<?php + +use Digitigrade\Model\Note; + +call_template('skeleton', ['pageTitle' => __('note.page.list.pageTitle')], function () { + ?> + <a class="button secondary margined" href="/pages/new"><?= __('note.page.new.pageTitle') ?></a> + <?php + + $notes = Note::findAllWithExtension(Note::EXTENSION_PAGES, 20); + foreach ($notes as $note) { + call_template('pages/list_item', ['note' => $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 @@ +<form id="writePageForm" hx-post="" hx-disabled-elt="find button"> + <div class="row"> + <label for="newPageTitle"><?= __('note.page.new.title.label') ?></label> + <input type="text" id="newPageTitle" name="title" required> + </div> + + <div class="row"> + <label for="newPageBody"><?= __('note.page.new.body.label') ?></label> + <textarea id="newPageBody" name="body" required></textarea> + <?php call_template('formatting_hint'); ?> + </div> + + <div class="row"> + <label for="newPageScope"><?= __('writeNote.scope.label') ?></label> + <select name="scope" id="newPageScope" required autocomplete="off"> + <option value="none"><?= __('note.privacy.scope.none') ?></option> + <option value="mutuals"><?= __('note.privacy.scope.mutuals') ?></option> + <option value="followers"><?= __('note.privacy.scope.followers') ?></option> + <option value="public" selected><?= __('note.privacy.scope.public') ?></option> + </select> + </div> + + <div class="row"> + <button type="submit" class="primary"><?= __('note.page.new.action') ?></button> + </div> +</form>
\ 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 @@ +<?php +call_template('skeleton', ['pageTitle' => __('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 @@ +<?php + +/** @var \Digitigrade\Model\Note $note */ + +use Digitigrade\FormattingProvider; +use Digitigrade\Model\UserAccount; +use Digitigrade\UserSettings; + +$page = $note->getPage(); + +call_template('skeleton', ['pageTitle' => $page->title, 'renderTitleHeading' => false], function () use ($note, $page) { ?> + <div class="notePage"> + <article lang="<?= htmlspecialchars($note->language) ?>"> + <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; ?> + <hr> + <div class="pageContent"> + <?= $page->getBestContentAsHtml() ?> + </div> + </article> + </div> +<?php });
\ No newline at end of file |
