Initial commit: simpleblog
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
{% extends "admin/base.html" %}
|
||||
{% block admin_content %}
|
||||
<div class="admin-panel">
|
||||
<h1>Categories</h1>
|
||||
<div class="admin-actions">
|
||||
<a class="primary" href="{{ url_for('admin.category_new') }}">+ New category</a>
|
||||
</div>
|
||||
|
||||
{% if categories is not none %}
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr><th>Name</th><th>Slug</th><th style="width:120px;">Actions</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for slug, name in categories %}
|
||||
<tr class="category-row">
|
||||
<td>{{ name }}</td>
|
||||
<td><code>{{ slug }}</code></td>
|
||||
<td>
|
||||
{% if slug != 'general' %}
|
||||
<form method="post" action="{{ url_for('admin.category_delete', slug=slug) }}" style="display:inline;" onsubmit="return confirm('Delete this category?');">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button class="btn btn-danger" type="submit">Delete</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<span class="field-hint">Default — cannot be deleted</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="empty-state">No categories yet.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if categories is none %}
|
||||
<div class="admin-panel">
|
||||
<h2>Add a category</h2>
|
||||
<form method="post" action="{{ url_for('admin.category_new') }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<div class="form-group">
|
||||
<label for="name">Category name</label>
|
||||
<input type="text" id="name" name="name" placeholder="e.g. Technology" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Create category</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user