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.
 
 
 
 
 
 

151 lines
6.7 KiB

{% extends 'layout.html.twig' %}
{% block body %}
{% if nzine is not defined %}
<section class="d-flex gap-3 center ln-section--newsstand">
<div class="container mt-3 mb-3">
<h1>{{ 'heading.createNzine'|trans }}</h1>
</div>
</section>
<div class="w-container mt-5">
<twig:Atoms:Alert type="info">N-Zines are in active development. Expect weirdness.</twig:Atoms:Alert>
{% if not is_granted('IS_AUTHENTICATED_FULLY') %}
<twig:Atoms:Alert type="default">
<strong>Login Required:</strong> You must be logged in to create an N-Zine.
Please log in to continue.
</twig:Atoms:Alert>
{% endif %}
<p class="lede">
An N-Zine is a digital magazine definition for
collecting long form articles from the <em>nostr</em> ecosystem according to specified filters.
The N-Zine can then be read and browsed as a traditional digital magazine made available on this platform.
Additionally, it can be subscribed to using the <em>nostr</em> bot which will be generated during the setup process.
Your currently logged-in <em>npub</em> will be assigned to the N-Zine as an editor, so you can come back later and tweak the filters.
</p>
<twig:Atoms:Alert type="info">
You can automatically aggregate content from RSS feeds.
Just provide a feed URL and configure categories with matching tags.
The system will periodically fetch new articles and publish them as Nostr events.
</twig:Atoms:Alert>
{{ form_start(form) }}
{{ form_widget(form) }}
{{ form_end(form) }}
</div>
{% else %}
<h1>{{ 'heading.editNzine'|trans }}</h1>
{% if not canCreateIndices %}
<twig:Atoms:Alert type="warning">
<strong>Ready to Publish:</strong> Add your categories below, then click "Publish N-Zine" to create all indices in one step.
{% if nzine.state != 'published' %}
<br><small>Current state: {{ nzine.state }}. Once published, you can add more categories later.</small>
{% endif %}
</twig:Atoms:Alert>
{% endif %}
{% if nzine.feedUrl %}
<twig:Atoms:Alert type="success">
<strong>RSS Feed:</strong> {{ nzine.feedUrl }}
{% if nzine.lastFetchedAt %}
<br><small>Last fetched: {{ nzine.lastFetchedAt|date('Y-m-d H:i:s') }}</small>
{% else %}
<br><small>{% if canCreateIndices %}Ready to fetch. Run: <code>php bin/console nzine:rss:fetch --nzine-id={{ nzine.id }}</code>{% else %}Feed will be available after publishing.{% endif %}</small>
{% endif %}
</twig:Atoms:Alert>
{% endif %}
{% if canCreateIndices %}
<h2>Indices</h2>
<ul>
{% for idx in indices %}
<li>{{ idx.getTitle() ?? 'Untitled' }}</li>
{% endfor %}
</ul>
{% endif %}
<h2>Categories</h2>
<p>
{% if canCreateIndices %}
Edit your categories. New categories will be added to the index. You have {{ nzine.mainCategories|length }} categories configured.
{% else %}
Add categories for your N-Zine. Categories help organize articles by topic.
{% if nzine.feedUrl %}
<br><strong>RSS Matching:</strong> Tags are used to match RSS feed items to categories (case-insensitive).
{% endif %}
{% endif %}
</p>
{{ form_start(catForm) }}
<ul class="tags">
{% for cat in catForm.categories %}
<li>{{ form_widget(cat) }}</li>
{% endfor %}
</ul>
<div {{ stimulus_controller('form-collection') }}
data-form-collection-index-value="{{ catForm.categories|length > 0 ? catForm.categories|last.vars.name + 1 : 0 }}"
data-form-collection-prototype-value="{{ form_widget(catForm.categories.vars.prototype)|e('html_attr') }}"
>
<ul {{ stimulus_target('form-collection', 'collectionContainer') }}></ul>
<button type="button" {{ stimulus_action('form-collection', 'addCollectionElement') }}>Add Category</button>
</div>
<button type="submit" class="btn btn-primary">Save Categories</button>
{{ form_end(catForm) }}
{% if not canCreateIndices and nzine.mainCategories|length > 0 %}
<hr>
<div class="publish-section" style="background: #f8f9fa; padding: 20px; border-radius: 8px; margin-top: 20px;">
<h3>Ready to Publish?</h3>
<p>
You have configured {{ nzine.mainCategories|length }} categories.
Click the button below to publish your N-Zine. This will:
</p>
<ul>
<li>Create the main index with references to all category indices</li>
<li>Generate and sign {{ nzine.mainCategories|length }} category indices</li>
<li>Make your N-Zine publicly available</li>
{% if nzine.feedUrl %}
<li>Enable RSS feed fetching for automatic content aggregation</li>
{% endif %}
</ul>
<form method="post" action="{{ path('nzine_publish', {npub: nzine.npub}) }}" onsubmit="return confirm('Are you ready to publish? This will create all indices and cannot be easily undone.');">
<button type="submit" class="btn btn-success btn-lg">
<strong>Publish N-Zine</strong>
</button>
</form>
<p style="margin-top: 10px;"><small><em>Note: You'll only need to sign the indices once. After publishing, you can still add more categories.</em></small></p>
</div>
{% endif %}
{% if nzine.feedUrl and canCreateIndices %}
<hr>
<h2>RSS Feed Management</h2>
<p>
<strong>Feed URL:</strong> {{ nzine.feedUrl }}<br>
{% if nzine.lastFetchedAt %}
<strong>Last Fetched:</strong> {{ nzine.lastFetchedAt|date('Y-m-d H:i:s') }}<br>
{% endif %}
</p>
<div class="rss-actions">
<p>Fetch RSS feed articles using the console command:</p>
<code style="display: block; background: #f5f5f5; padding: 10px; margin: 10px 0; border-radius: 4px;">
docker-compose exec php php bin/console nzine:rss:fetch --nzine-id={{ nzine.id }}
</code>
<p><small>Or test without publishing: <code>--dry-run</code></small></p>
<p><small>Set up a cron job to automate fetching. See documentation for details.</small></p>
</div>
{% endif %}
{% endif %}
{% endblock %}