]> git.bts.cx Git - cx.git/commitdiff
Admin fixes
authorBen Sherratt <redacted>
Sat, 4 Jul 2026 11:33:52 +0000 (12:33 +0100)
committerBen Sherratt <redacted>
Sat, 4 Jul 2026 11:33:52 +0000 (12:33 +0100)
cx/lib/posts.php
cx/templates/admin/main.php
public/design/css/cx.css

index d8f056d970d74c73af96978283630d6124db4890..e46aa28cd6816f79a5827f5c7fe17a6f8fecd198 100644 (file)
@@ -237,7 +237,7 @@ function cx_posts_find_page_id($post_slug) {
        return null;
 }
 
        return null;
 }
 
-function cx_pages_get() {
+function cx_pages_get(bool $include_drafts = false) {
        $sql = 'SELECT
                post_id,
                post_slug,
        $sql = 'SELECT
                post_id,
                post_slug,
@@ -247,9 +247,15 @@ function cx_pages_get() {
                post_title,
                post_data
                FROM posts
                post_title,
                post_data
                FROM posts
-               WHERE post_is_page == TRUE
-               AND post_is_draft == FALSE
-               ORDER BY post_creation_time ASC;';
+               WHERE post_is_page == TRUE';
+
+       if ($include_drafts == false) {
+               $sql .= ' AND post_is_draft == FALSE';
+       }
+
+       $sql .= ' ORDER BY post_date ASC';
+
+       $sql .= ';';
 
        foreach (cx_db_query($sql) as $post) {
                $p = new Post($post);
 
        foreach (cx_db_query($sql) as $post) {
                $p = new Post($post);
index 799db8805b6846c2a547dd9df58ec02f3f0f941d..c0da49a4d425560a027fc85bee915d9577232c11 100644 (file)
@@ -1,22 +1,34 @@
 <?php cx_template_base('base'); ?>
 
 <h2>Posts</h2>
 <?php cx_template_base('base'); ?>
 
 <h2>Posts</h2>
-<ul role="list">
+<table>
 <?php foreach (cx_posts_get(include_drafts: true) as $post): ?>
 <?php foreach (cx_posts_get(include_drafts: true) as $post): ?>
-<li><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a> <a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">🚮</a></li>
+<tr>
+ <td class="fill"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>">Edit</a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">Delete</a></td>
+</tr>
 <?php endforeach; ?>
 <?php endforeach; ?>
-</ul>
+</table>
 
 <h2>Pages</h2>
 
 <h2>Pages</h2>
-<ul role="list">
-<?php foreach (cx_pages_get() as $post): ?>
-<li><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a> <a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">🚮</a></li>
+<table>
+<?php foreach (cx_pages_get(include_drafts: true) as $post): ?>
+<tr>
+ <td class="fill"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>">Edit</a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">Delete</a></td>
+</tr>
 <?php endforeach; ?>
 <?php endforeach; ?>
-</ul>
+</table>
 
 <h2>Images</h2>
 
 <h2>Images</h2>
-<ul role="list">
+<table>
 <?php foreach (cx_images_get() as $image): ?>
 <?php foreach (cx_images_get() as $image): ?>
-<li><a href="<?= cx_url_admin('/images/edit?id=' . $image->id); ?>"><?= $image->url ?></a> <a href="<?= cx_url_admin('/images/delete?id=' . $image->id); ?>">🚮</a></li>
+<tr>
+ <td class="fill"><a href="<?= $image->url ?>"><?= $image->url ?></a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/images/edit?id=' . $image->id); ?>">Edit</a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/images/delete?id=' . $image->id); ?>">Delete</a></td>
+</tr>
 <?php endforeach; ?>
 <?php endforeach; ?>
-</ul>
+</table>
index b920c7ee6a48cacc1ed96cc31519b3df5e5b57da..eb2b1ba03f65e96cb0fba6bad6dabda4c09b3f48 100644 (file)
@@ -82,6 +82,7 @@ nav [aria-current="page"] {
 }
 
 main {
 }
 
 main {
+       margin: 50px 100px;
        margin-left: calc(var(--sidebar-width) + 50px);
 }
 
        margin-left: calc(var(--sidebar-width) + 50px);
 }
 
@@ -213,7 +214,26 @@ blockquote {
 }
 
 
 }
 
 
+table {
+       width: 100%;
+}
+
+tr:nth-child(even) {
+       background-color: #f2f2f2;
+}
+
+tr:hover {
+       background-color: #f2f2ff;
+}
 
 
+td.fill {
+       width: 100%;
+}
+
+td a {
+       display: block;
+       padding: 2px;
+}
 
 input, textarea {
        font-size: 1em;
 
 input, textarea {
        font-size: 1em;