119 lines
5.0 KiB
HTML
119 lines
5.0 KiB
HTML
{% extends "admin/base.html" %}
|
|
|
|
{% block title %}Edit Note - StarPunk Admin{% endblock %}
|
|
|
|
{% block admin_content %}
|
|
<div class="note-editor">
|
|
<h2>Edit Note</h2>
|
|
<p class="note-meta">
|
|
Slug: <code>{{ note.slug }}</code> |
|
|
Created: {{ note.created_at.strftime('%B %d, %Y at %I:%M %p') }}
|
|
</p>
|
|
|
|
<form action="{{ url_for('admin.update_note_submit', note_id=note.id) }}" method="POST" class="note-form"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<div class="form-group">
|
|
{% if note.reacts_to %}
|
|
<p class="note-meta">{{ {'like': '★ Like of', 'repost': '🔁 Repost of', 'bookmark': '🔖 Bookmark of'}[note.kind] }} <a href="{{ note.reacts_to }}">{{ note.reacts_to }}</a></p>
|
|
{% endif %}
|
|
<label for="content">{% if note.reacts_to %}Comment (optional, Markdown){% else %}Content (Markdown){% endif %}</label>
|
|
<textarea
|
|
id="content"
|
|
name="content"
|
|
rows="{{ 6 if note.reacts_to else 20 }}"
|
|
{% if not note.reacts_to %}required{% endif %}
|
|
autofocus
|
|
>{{ note.content }}</textarea>
|
|
<small>Use Markdown syntax for formatting</small>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="slug">Slug (permanent)</label>
|
|
<input type="text"
|
|
id="slug"
|
|
name="slug"
|
|
value="{{ note.slug }}"
|
|
readonly
|
|
class="form-control"
|
|
disabled>
|
|
<small class="form-text text-muted">
|
|
Slugs cannot be changed after creation to preserve permalinks.
|
|
</small>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="tags">Tags</label>
|
|
<input type="text"
|
|
id="tags"
|
|
name="tags"
|
|
value="{{ note.tags|map(attribute='display_name')|join(', ') if note.tags else '' }}"
|
|
placeholder="Comma-separated tags (e.g., IndieWeb, Python, Thoughts)">
|
|
<small>Separate multiple tags with commas. Leave blank to remove all tags.</small>
|
|
</div>
|
|
|
|
<div class="form-group form-checkbox">
|
|
<input type="checkbox" id="published" name="published" {% if note.published %}checked{% endif %}>
|
|
<label for="published">Published</label>
|
|
</div>
|
|
|
|
{% if syndication_targets %}
|
|
<input type="hidden" name="syndication_form" value="1">
|
|
<fieldset class="form-group">
|
|
<legend>Crosspost</legend>
|
|
{% for target in syndication_targets %}
|
|
<div class="form-checkbox">
|
|
<input type="checkbox" id="syndicate-{{ target.id }}" name="syndicate_to" value="{{ target.id }}"{% if target.id in syndication_enabled %} checked{% endif %}>
|
|
<label for="syndicate-{{ target.id }}">{{ target.name }}</label>
|
|
</div>
|
|
{% endfor %}
|
|
</fieldset>
|
|
{% endif %}
|
|
|
|
<div class="form-actions">
|
|
<button type="submit" class="button button-primary">Update Note</button>
|
|
<a href="{{ url_for('admin.dashboard') }}" class="button button-secondary">Cancel</a>
|
|
<button type="submit" form="delete-note-form" class="button button-danger">Delete Note</button>
|
|
</div>
|
|
</form>
|
|
|
|
{# Outside the edit form: nested forms are not allowed in HTML #}
|
|
<form id="delete-note-form" action="{{ url_for('admin.delete_note_submit', note_id=note.id) }}" method="POST" class="delete-form" onsubmit="return confirm('Are you sure you want to delete this note? This cannot be undone.');"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<input type="hidden" name="confirm" value="yes">
|
|
</form>
|
|
|
|
{% if syndications %}
|
|
<section class="syndication-status">
|
|
<h3>Crossposts</h3>
|
|
<ul>
|
|
{% for s in syndications %}
|
|
<li>
|
|
<strong>{{ s.name }}</strong>:
|
|
{% if s.state == 'synced' and s.remote_url %}
|
|
<a href="{{ s.remote_url }}" rel="noopener">posted</a>
|
|
{% elif s.state == 'synced' %}
|
|
removed
|
|
{% elif s.state == 'pending' %}
|
|
pending{% if s.attempts %} (retry {{ s.attempts }}){% endif %}
|
|
{% else %}
|
|
failed
|
|
{% endif %}
|
|
{% if s.last_error %}<br><small>{{ s.last_error }}</small>{% endif %}
|
|
{% if s.state != 'synced' %}
|
|
<form action="{{ url_for('admin.retry_syndication', syndication_id=s.id) }}" method="POST" style="display: inline;"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button type="submit" class="button button-secondary">Retry now</button>
|
|
</form>
|
|
{% endif %}
|
|
{% if backfeed_enabled and s.state == 'synced' and s.remote_id %}
|
|
<br><small>Responses {% if s.backfeed_checked_at %}checked {{ s.backfeed_checked_at }} UTC{% else %}not checked yet{% endif %}{% if s.backfeed_error %}: {{ s.backfeed_error }}{% endif %}</small>
|
|
<form action="{{ url_for('admin.check_syndication_responses', syndication_id=s.id) }}" method="POST" style="display: inline;"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button type="submit" class="button button-secondary">Check now</button>
|
|
</form>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</section>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|
|
|