aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/Views
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-03-21 22:46:34 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-03-21 22:46:34 +0100
commitec77d2f77b96488b1bc170ced2abab12b3c19416 (patch)
treed27fa6b4bcee9a8f204510ddb855e135562031f3 /src/app/Views
parentd63e3c91a97d77b202e280ab0fa007dfbe1baa46 (diff)
downloadcamagru-ec77d2f77b96488b1bc170ced2abab12b3c19416.tar.gz
camagru-ec77d2f77b96488b1bc170ced2abab12b3c19416.zip
Add user's own posts grid and post deletion to editor page
Diffstat (limited to 'src/app/Views')
-rw-r--r--src/app/Views/editor/index.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/app/Views/editor/index.php b/src/app/Views/editor/index.php
index 624002a..7f2c258 100644
--- a/src/app/Views/editor/index.php
+++ b/src/app/Views/editor/index.php
@@ -46,4 +46,19 @@
<button id="btn-save" class="btn" disabled>Save post</button>
</div>
</div>
+
+ <?php if (!empty($userPosts)): ?>
+ <h2 class="my-posts-title">My posts</h2>
+ <div class="my-posts-grid">
+ <?php foreach ($userPosts as $post): ?>
+ <div class="my-post">
+ <img src="/<?= htmlspecialchars($post['image_path']) ?>" alt="My post">
+ <form method="POST" action="/editor/delete/<?= $post['id'] ?>" class="delete-form">
+ <?= \App\Csrf::field() ?>
+ <button type="submit" class="btn-delete" onclick="return confirm('Delete this post?')">Delete</button>
+ </form>
+ </div>
+ <?php endforeach; ?>
+ </div>
+ <?php endif; ?>
</div>