| {% extends "layout.html" %} |
|
|
| {% block title %}{{ "Edit Post" if is_edit else "Post Reply" }} - Community Forum{% endblock %} |
|
|
| {% block breadcrumb %} |
| <a href="{{ url_for('forum.index') }}" class="hover:text-blue-600">Home</a> |
| <span class="mx-2">/</span> |
| <a href="{{ url_for('forum.category_view', id=topic.category_id) }}" class="hover:text-blue-600">{{ topic.category.name }}</a> |
| <span class="mx-2">/</span> |
| <a href="{{ url_for('forum.topic_view', id=topic.id) }}" class="hover:text-blue-600">{{ topic.title }}</a> |
| <span class="mx-2">/</span> |
| <span>{{ "Edit Post" if is_edit else "Reply" }}</span> |
| {% endblock %} |
|
|
| {% block content %} |
| <div class="bg-white rounded-lg shadow overflow-hidden"> |
| <div class="px-6 py-4 border-b border-gray-200"> |
| <h1 class="text-2xl font-bold text-gray-800">{{ "Edit Post" if is_edit else "Post Reply" }}</h1> |
| <p class="text-gray-600 mt-1"> |
| {% if is_edit %} |
| Edit your message in "{{ topic.title }}" |
| {% elif is_quote %} |
| Reply with quote to "{{ topic.title }}" |
| {% else %} |
| Respond to "{{ topic.title }}" |
| {% endif %} |
| </p> |
| </div> |
| |
| <div class="p-6"> |
| {% if is_edit %} |
| <form method="POST" action="{{ url_for('forum.edit_post', id=post.id) }}"> |
| {% else %} |
| <form method="POST" action="{{ url_for('forum.topic_view', id=topic.id) }}"> |
| {% endif %} |
| {{ form.hidden_tag() }} |
| {{ form.topic_id }} |
| |
| <div class="mb-4"> |
| <label for="content" class="block text-gray-700 font-medium mb-2">Content</label> |
| <div class="editor-container"> |
| <div class="editor-toolbar bg-white border border-gray-300"> |
| |
| </div> |
| |
| {{ form.content(class="w-full px-4 py-2 border border-gray-300 editor-textarea focus:outline-none focus:border-blue-500 focus:ring focus:ring-blue-200", id="content", rows="10") }} |
| </div> |
| {% if form.content.errors %} |
| <div class="text-red-600 text-sm mt-1"> |
| {% for error in form.content.errors %} |
| <p>{{ error }}</p> |
| {% endfor %} |
| </div> |
| {% endif %} |
| </div> |
| |
| <div class="flex items-center justify-between"> |
| <a href="{{ url_for('forum.topic_view', id=topic.id) }}" class="px-4 py-2 bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 transition-colors"> |
| Cancel |
| </a> |
| <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors"> |
| {% if is_edit %} |
| Save Changes |
| {% else %} |
| Post Reply |
| {% endif %} |
| </button> |
| </div> |
| </form> |
| </div> |
| </div> |
| {% endblock %} |
|
|
| {% block extra_js %} |
| <script src="{{ url_for('static', filename='js/editor.js') }}"></script> |
| {% endblock %} |
|
|