clone of github.com/decent-newsroom/newsroom
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.
 
 
 
 
 
 

86 lines
3.6 KiB

{% extends 'layout.html.twig' %}
{% block body %}
<h1>Edit Index: {{ title }}</h1>
<div class="magazine-editor-layout">
<!-- Left: Search articles -->
<section class="magazine-editor-section">
<form method="get" action="{{ path('admin_magazine_edit', {slug: slug}) }}" class="magazine-search-form">
<input type="text" name="q" value="{{ q }}" placeholder="Search articles…">
<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 class="magazine-table">
<tbody>
{% for article in results %}
<tr>
<td>
📄 <a href="{{ path('article-slug', {slug: article.slug|url_encode}) }}">{{ article.title }}</a>
<div class="small text-muted">slug: {{ article.slug }}</div>
</td>
<td class="author">
{% set pubkey = article.pubkey %}
<a href="{{ path('author-redirect', {pubkey: pubkey}) }}">{{ pubkey|slice(0,8) ~ '…' ~ pubkey|slice(-4) }}</a>
</td>
<td class="actions">
<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 class="magazine-editor-section">
<h3 class="mb-2">Current entries</h3>
{% if current is empty %}
<div class="text-muted">No entries yet.</div>
{% else %}
<table class="magazine-table">
<tbody>
{% for item in current %}
<tr>
<td>
{% 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 class="author">
<a href="{{ path('author-redirect', {pubkey: item.pubkey}) }}">{{ item.pubkey|slice(0,8) ~ '…' ~ item.pubkey|slice(-4) }}</a>
</td>
<td class="actions">
{% 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 %}