Edit page working

This commit is contained in:
2025-08-12 23:08:20 -07:00
parent 4aebef12c8
commit 2f76c1ae35
15 changed files with 272 additions and 7 deletions

32
views/editpage.html.twig Normal file
View File

@@ -0,0 +1,32 @@
{% extends '@novaconium/master.html.twig' %}
{% block content %}
<h2>Edit Page - {{ title }}</h2>
<form method="post" action="/novaconium/savePage">
<input type="hidden" name="id" value="{{ rows.id }}">
<input type="hidden" name="token" value="{{ token }}">
<label for="title">Title:</label>
<input type="text" id="title" name="title" value="{{ rows.title }}" required>
<label for="slug">Slug: (<a href="/page/{{ rows.slug }}" target="_new">/page/{{ rows.slug }}</a>)</label>
<input type="text" id="slug" name="slug" value="{{ rows.slug }}" required>
<label for="body">Body:</label>
<textarea id="body" name="body" rows="10" required>{{ rows.body }}</textarea>
<label for="intro">Intro:</label>
<textarea id="intro" name="intro" rows="10" required>{{ rows.intro }}</textarea>
<label for="draft">
<input type="checkbox" id="draft" name="draft" value="1" {% if rows.draft %}checked{% endif %}>
Save as Draft
</label>
<p><strong>Created:</strong> {{ rows.created|date("Y-m-d H:i:s") }}</p>
<p><strong>Last Updated:</strong> {{ rows.updated|date("Y-m-d H:i:s") }}</p>
<button type="submit">Save Changes</button>
</form>
{% endblock %}

29
views/pages.html.twig Normal file
View File

@@ -0,0 +1,29 @@
{% extends '@novaconium/master.html.twig' %}
{% block content %}
<h1>{{title}}</h1>
<table class="pages-table">
<thead>
<tr>
<th>Title</th>
<th>Created</th>
<th>Updated</th>
<th>Draft</th>
</tr>
</thead>
<tbody>
{% for page in pages %}
<tr>
<td><a href="/novaconium/page/edit/{{ page.id }}">{{ page.title }}</a></td>
<td>{{ page.created }}</td>
<td>{{ page.updated|default('Not updated') }}</td>
<td>{{ page.draft ? 'Draft' : 'Published' }}</td>
</tr>
{% else %}
<tr>
<td colspan="6">No pages found.</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}