You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
4.0 KiB
87 lines
4.0 KiB
{% extends 'layout.html.twig' %} |
|
|
|
{% block body %} |
|
<h1>Edit Index: {{ title }}</h1> |
|
<div class="d-flex gap-4"> |
|
<!-- Left: Search articles --> |
|
<section style="flex:1;min-width:320px;"> |
|
<form method="get" action="{{ path('admin_magazine_edit', {slug: slug}) }}" class="mb-3 d-flex gap-2"> |
|
<input type="text" name="q" value="{{ q }}" placeholder="Search articles…" style="flex:1;"> |
|
<button class="btn btn-primary" type="submit">Search</button> |
|
</form> |
|
|
|
{% if q %} |
|
<h3 class="mb-2">Results for “{{ q }}”</h3> |
|
{% if results is empty %} |
|
<div class="text-muted">No results.</div> |
|
{% else %} |
|
<table style="width:100%;border-collapse:collapse;"> |
|
<tbody> |
|
{% for article in results %} |
|
<tr> |
|
<td style="padding:.25rem .5rem;vertical-align:top;"> |
|
📄 <a href="{{ path('article-slug', {slug: article.slug|url_encode}) }}">{{ article.title }}</a> |
|
<div class="small text-muted">slug: {{ article.slug }}</div> |
|
</td> |
|
<td style="padding:.25rem .5rem;white-space:nowrap;vertical-align:top;"> |
|
{% set pubkey = article.pubkey %} |
|
<a href="{{ path('author-redirect', {pubkey: pubkey}) }}">{{ pubkey|slice(0,8) ~ '…' ~ pubkey|slice(-4) }}</a> |
|
</td> |
|
<td style="padding:.25rem .5rem;text-align:right;vertical-align:top;"> |
|
<form method="post" action="{{ path('admin_magazine_add_article', {slug: slug}) }}"> |
|
<input type="hidden" name="_token" value="{{ csrfToken }}"> |
|
<input type="hidden" name="article_slug" value="{{ article.slug }}"> |
|
<input type="hidden" name="article_pubkey" value="{{ article.pubkey }}"> |
|
<input type="hidden" name="q" value="{{ q }}"> |
|
<button class="btn btn-sm" type="submit">Add</button> |
|
</form> |
|
</td> |
|
</tr> |
|
{% endfor %} |
|
</tbody> |
|
</table> |
|
{% endif %} |
|
{% endif %} |
|
</section> |
|
|
|
<!-- Right: Current index contents --> |
|
<section style="flex:1;min-width:320px;"> |
|
<h3 class="mb-2">Current entries</h3> |
|
{% if current is empty %} |
|
<div class="text-muted">No entries yet.</div> |
|
{% else %} |
|
<table style="width:100%;border-collapse:collapse;"> |
|
<tbody> |
|
{% for item in current %} |
|
<tr> |
|
<td style="padding:.25rem .5rem;vertical-align:top;"> |
|
{% if item.kind == '30023' %} |
|
📄 <a href="{{ path('article-slug', {slug: item.slug|url_encode}) }}">{{ item.slug }}</a> |
|
{% elseif item.kind == '30040' %} |
|
📁 <a href="{{ path('admin_magazine_edit', {slug: item.slug}) }}">{{ item.slug }}</a> |
|
{% else %} |
|
{{ item.slug }} |
|
{% endif %} |
|
<div class="small text-muted">coord: {{ item.coord }}</div> |
|
</td> |
|
<td style="padding:.25rem .5rem;white-space:nowrap;vertical-align:top;"> |
|
<a href="{{ path('author-redirect', {pubkey: item.pubkey}) }}">{{ item.pubkey|slice(0,8) ~ '…' ~ item.pubkey|slice(-4) }}</a> |
|
</td> |
|
<td style="padding:.25rem .5rem;text-align:right;vertical-align:top;"> |
|
{% if item.kind == '30023' %} |
|
<form method="post" action="{{ path('admin_magazine_remove_article', {slug: slug}) }}"> |
|
<input type="hidden" name="_token" value="{{ csrfToken }}"> |
|
<input type="hidden" name="article_slug" value="{{ item.slug }}"> |
|
<button class="btn btn-sm" type="submit">Remove</button> |
|
</form> |
|
{% endif %} |
|
</td> |
|
</tr> |
|
{% endfor %} |
|
</tbody> |
|
</table> |
|
{% endif %} |
|
</section> |
|
</div> |
|
{% endblock %} |
|
|
|
|