Initial dev export (exclude uploads/runtime)
This commit is contained in:
67
modules/blog/views/admin/edit.php
Normal file
67
modules/blog/views/admin/edit.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
$pageTitle = $title ?? 'Edit Post';
|
||||
$post = $post ?? [];
|
||||
$error = $error ?? '';
|
||||
ob_start();
|
||||
?>
|
||||
<section class="admin-card">
|
||||
<div class="badge">Blog</div>
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
||||
<div>
|
||||
<h1 style="font-size:28px; margin:0;"><?= htmlspecialchars($pageTitle, ENT_QUOTES, 'UTF-8') ?></h1>
|
||||
<p style="color: var(--muted); margin-top:6px;">Write a news post or update.</p>
|
||||
</div>
|
||||
<a href="/admin/posts" class="btn outline">Back</a>
|
||||
</div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div style="margin-top:16px; color:#f3b0b0; font-size:13px;"><?= htmlspecialchars($error, ENT_QUOTES, 'UTF-8') ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="/admin/posts/save" style="margin-top:18px; display:grid; gap:16px;">
|
||||
<input type="hidden" name="id" value="<?= (int)($post['id'] ?? 0) ?>">
|
||||
<div class="admin-card" style="padding:16px;">
|
||||
<div style="display:grid; gap:12px;">
|
||||
<label class="label">Title</label>
|
||||
<input class="input" name="title" value="<?= htmlspecialchars((string)($post['title'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="Post title">
|
||||
<label class="label">Slug</label>
|
||||
<input class="input" name="slug" value="<?= htmlspecialchars((string)($post['slug'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="post-title">
|
||||
<label class="label">Excerpt</label>
|
||||
<textarea class="input" name="excerpt" rows="3" style="resize:vertical;"><?= htmlspecialchars((string)($post['excerpt'] ?? ''), ENT_QUOTES, 'UTF-8') ?></textarea>
|
||||
<label class="label">Featured Image URL</label>
|
||||
<input class="input" name="featured_image_url" value="<?= htmlspecialchars((string)($post['featured_image_url'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="https://example.com/cover.jpg">
|
||||
<label class="label">Author</label>
|
||||
<input class="input" name="author_name" value="<?= htmlspecialchars((string)($post['author_name'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="AudioCore Team">
|
||||
<label class="label">Category</label>
|
||||
<input class="input" name="category" value="<?= htmlspecialchars((string)($post['category'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="News">
|
||||
<label class="label">Tags (comma separated)</label>
|
||||
<input class="input" name="tags" value="<?= htmlspecialchars((string)($post['tags'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="release, label, update">
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; gap:12px;">
|
||||
<label class="label" style="margin:0;">Content (HTML)</label>
|
||||
<button type="button" class="btn outline small" data-media-picker="blog_content_html">Insert Media</button>
|
||||
</div>
|
||||
<textarea class="input" id="blog_content_html" name="content_html" rows="16" style="resize:vertical; font-family:'IBM Plex Mono', monospace; font-size:13px; line-height:1.6;"><?= htmlspecialchars((string)($post['content_html'] ?? ''), ENT_QUOTES, 'UTF-8') ?></textarea>
|
||||
<label class="label">Published At</label>
|
||||
<input class="input" name="published_at" value="<?= htmlspecialchars((string)($post['published_at'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="2026-01-25 18:30:00">
|
||||
<label style="display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em;">
|
||||
<input type="checkbox" name="is_published" value="1" <?= ((int)($post['is_published'] ?? 0) === 1) ? 'checked' : '' ?>>
|
||||
Published
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display:flex; justify-content:flex-end; gap:12px; align-items:center;">
|
||||
<button type="submit" class="btn">Save post</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php if (!empty($post['id'])): ?>
|
||||
<form method="post" action="/admin/posts/delete" onsubmit="return confirm('Delete this post?');" style="margin-top:12px;">
|
||||
<input type="hidden" name="id" value="<?= (int)($post['id'] ?? 0) ?>">
|
||||
<button type="submit" class="btn outline">Delete</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
require __DIR__ . '/../../../admin/views/layout.php';
|
||||
54
modules/blog/views/admin/index.php
Normal file
54
modules/blog/views/admin/index.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
$pageTitle = 'Posts';
|
||||
$posts = $posts ?? [];
|
||||
ob_start();
|
||||
?>
|
||||
<section class="admin-card">
|
||||
<div class="badge">Blog</div>
|
||||
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
||||
<div>
|
||||
<h1 style="font-size:28px; margin:0;">Posts</h1>
|
||||
<p style="color: var(--muted); margin-top:6px;">Publish news updates and announcements.</p>
|
||||
</div>
|
||||
<a href="/admin/posts/new" class="btn small">New Post</a>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:18px; display:grid; gap:10px;">
|
||||
<div style="display:grid; grid-template-columns: 2fr 1fr 140px 140px 160px 120px; gap:12px; font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em;">
|
||||
<div>Title</div>
|
||||
<div>Slug</div>
|
||||
<div>Author</div>
|
||||
<div>Status</div>
|
||||
<div>Published</div>
|
||||
<div>Actions</div>
|
||||
</div>
|
||||
<?php if (!$posts): ?>
|
||||
<div style="color: var(--muted); font-size:13px;">No posts yet.</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($posts as $post): ?>
|
||||
<div style="display:grid; grid-template-columns: 2fr 1fr 140px 140px 160px 120px; gap:12px; align-items:center; padding:10px 12px; border-radius:16px; border:1px solid var(--stroke); background: rgba(14,14,16,0.9);">
|
||||
<div style="font-weight:600;"><?= htmlspecialchars((string)($post['title'] ?? ''), ENT_QUOTES, 'UTF-8') ?></div>
|
||||
<div style="font-size:12px; color:var(--muted); font-family: 'IBM Plex Mono', monospace;">
|
||||
<?= htmlspecialchars((string)($post['slug'] ?? ''), ENT_QUOTES, 'UTF-8') ?>
|
||||
</div>
|
||||
<div style="font-size:12px; color:var(--muted);">
|
||||
<?= htmlspecialchars((string)($post['author_name'] ?? ''), ENT_QUOTES, 'UTF-8') ?>
|
||||
</div>
|
||||
<div style="font-size:12px; color:<?= ((int)($post['is_published'] ?? 0) === 1) ? 'var(--accent-2)' : 'var(--muted)' ?>;">
|
||||
<?= ((int)($post['is_published'] ?? 0) === 1) ? 'Published' : 'Draft' ?>
|
||||
</div>
|
||||
<div style="font-size:12px; color:var(--muted);">
|
||||
<?= htmlspecialchars((string)($post['published_at'] ?? ''), ENT_QUOTES, 'UTF-8') ?>
|
||||
</div>
|
||||
<div style="display:flex; gap:8px;">
|
||||
<a href="/admin/posts/edit?id=<?= (int)$post['id'] ?>" class="btn outline small">Edit</a>
|
||||
<a href="/news/<?= htmlspecialchars((string)($post['slug'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" class="btn outline small">View</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
require __DIR__ . '/../../../admin/views/layout.php';
|
||||
Reference in New Issue
Block a user