Initial commit: simpleblog
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
{% extends "admin/base.html" %}
|
||||
{% block admin_content %}
|
||||
<div class="admin-panel">
|
||||
<h1>Links</h1>
|
||||
<p class="field-hint">
|
||||
These appear in the “Links” panel in the site sidebar, in the order
|
||||
listed below. The panel stays hidden until at least one link is added.
|
||||
</p>
|
||||
|
||||
<form method="post" action="{{ url_for('admin.links') }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label for="link-label">Label</label>
|
||||
<input type="text" id="link-label" name="label" placeholder="GitHub" maxlength="80" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="link-url">URL</label>
|
||||
<input type="text" id="link-url" name="url" placeholder="https://github.com/you" maxlength="500" required>
|
||||
<span class="field-hint">A bare domain gets https:// added automatically.</span>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Add link</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="admin-panel">
|
||||
<h2>Current links</h2>
|
||||
{% if links %}
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr><th>Label</th><th>URL</th><th style="width:120px;">Actions</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for link in links %}
|
||||
<tr>
|
||||
<td>{{ link.label }}</td>
|
||||
<td><a href="{{ link.url }}" target="_blank" rel="noopener noreferrer">{{ link.url }}</a></td>
|
||||
<td>
|
||||
<form method="post" action="{{ url_for('admin.link_delete', lid=link.id) }}" onsubmit="return confirm('Remove this link?');">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button type="submit" class="btn btn-danger btn-small">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="empty-state">No links yet — so the sidebar panel is currently hidden.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user