Files
51l3nt51n-blog/templates/post_edit.html

65 lines
2.3 KiB
HTML

{% extends "base.html" %}
{% block title %}
{% if post.is_some() %}Edit Post{% else %}New Post{% endif %}
{% endblock %}
{% block content %}
<h2>{% if post.is_some() %}Edit Post{% else %}New Post{% endif %}</h2>
<a href="/__dungeon/posts">Back to Posts</a>
<br><br>
{% if let Some(err) = error %}
<font color="red"><b>{{ err }}</b></font><br><br>
{% endif %}
{% if let Some(p) = post %}
<form method="POST" action="/__dungeon/posts/edit/{{ p.id }}">
{% else %}
<form method="POST" action="/__dungeon/posts/new">
{% endif %}
<b>Title:</b><br>
<input type="text" name="title" size="50" required
value="{% if let Some(p) = post %}{{ p.title }}{% endif %}"><br><br>
<b>Content (Plain Text):</b><br>
<textarea name="content" rows="15" cols="80"
required>{% if let Some(p) = post %}{{ p.content }}{% endif %}</textarea><br><br>
<b>Tags (comma separated):</b><br>
<input type="text" name="tags" size="50" value="{% if let Some(p) = post %}{{ p.tags }}{% endif %}"><br><br>
<b>Categories (comma separated):</b><br>
<input type="text" name="categories" size="50"
value="{% if let Some(p) = post %}{{ p.categories }}{% endif %}"><br><br>
<b>Visibility:</b><br>
<select name="visibility">
<option value="public" {% if let Some(p)=post %}{% if p.visibility=="public" %}selected{% endif %}{% endif
%}>
Public
</option>
<option value="private" {% if let Some(p)=post %}{% if p.visibility=="private" %}selected{% endif %}{% endif
%}>
Private (Requires Login)
</option>
<option value="password_protected" {% if let Some(p)=post %}{% if p.visibility=="password_protected"
%}selected{% endif %}{% endif %}>
Password Protected
</option>
</select><br><br>
<b>Password (only used if Visibility is Password Protected):</b><br>
<input type="text" name="password" size="20" placeholder="Optional">
{% if let Some(p) = post %}
{% if p.visibility == "password_protected" %}
<i>(Leave blank to keep existing password)</i>
{% endif %}
{% endif %}
<br><br>
<input type="submit" value="Save Post">
</form>
{% endblock %}