|
{% extends "layout.html" %} |
|
|
|
{% block title %}Create New Topic - 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_list') }}" class="hover:text-blue-600">Categories</a> |
|
<span class="mx-2">/</span> |
|
<span>Create New Topic</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">Create New Topic</h1> |
|
<p class="text-gray-600 mt-1">Start a new discussion</p> |
|
</div> |
|
|
|
<div class="p-6"> |
|
<form method="POST" action="{{ url_for('forum.create_topic') }}"> |
|
{{ form.hidden_tag() }} |
|
|
|
<div class="mb-4"> |
|
<label for="category_id" class="block text-gray-700 font-medium mb-2">Category</label> |
|
{{ form.category_id(class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500 focus:ring focus:ring-blue-200", id="category_id") }} |
|
{% if form.category_id.errors %} |
|
<div class="text-red-600 text-sm mt-1"> |
|
{% for error in form.category_id.errors %} |
|
<p>{{ error }}</p> |
|
{% endfor %} |
|
</div> |
|
{% endif %} |
|
</div> |
|
|
|
<div class="mb-4"> |
|
<label for="title" class="block text-gray-700 font-medium mb-2">Title</label> |
|
{{ form.title(class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500 focus:ring focus:ring-blue-200", id="title", placeholder="Enter a descriptive title...") }} |
|
{% if form.title.errors %} |
|
<div class="text-red-600 text-sm mt-1"> |
|
{% for error in form.title.errors %} |
|
<p>{{ error }}</p> |
|
{% endfor %} |
|
</div> |
|
{% endif %} |
|
</div> |
|
|
|
<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", placeholder="Write your post content here...") }} |
|
</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="mb-6"> |
|
<label for="tags" class="block text-gray-700 font-medium mb-2">Tags <span class="text-gray-500 text-sm">(comma separated)</span></label> |
|
{{ form.tags(class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500 focus:ring focus:ring-blue-200", id="tags", placeholder="example, discussion, question") }} |
|
{% if form.tags.errors %} |
|
<div class="text-red-600 text-sm mt-1"> |
|
{% for error in form.tags.errors %} |
|
<p>{{ error }}</p> |
|
{% endfor %} |
|
</div> |
|
{% endif %} |
|
<p class="text-gray-500 text-xs mt-1">Tags help categorize your topic and make it easier to find. Separate multiple tags with commas.</p> |
|
</div> |
|
|
|
<div class="flex items-center justify-between"> |
|
<a href="{{ url_for('forum.index') }}" 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"> |
|
Create Topic |
|
</button> |
|
</div> |
|
</form> |
|
</div> |
|
</div> |
|
{% endblock %} |
|
|
|
{% block extra_js %} |
|
<script src="{{ url_for('static', filename='js/editor.js') }}"></script> |
|
{% endblock %} |
|
|