|
{% extends "layout.html" %} |
|
|
|
{% block title %}Edit Profile - 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('user.profile', username=current_user.username) }}" class="hover:text-blue-600">Profile</a> |
|
<span class="mx-2">/</span> |
|
<span>Edit Profile</span> |
|
{% endblock %} |
|
|
|
{% block content %} |
|
<div class="max-w-2xl mx-auto"> |
|
<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 Profile</h1> |
|
<p class="text-gray-600 mt-1">Update your personal information</p> |
|
</div> |
|
|
|
<div class="p-6"> |
|
<form method="POST" action="{{ url_for('user.edit_profile') }}" enctype="multipart/form-data"> |
|
{{ form.hidden_tag() }} |
|
|
|
<div class="mb-6"> |
|
<label class="block text-gray-700 font-medium mb-2">Avatar</label> |
|
<div class="flex items-center"> |
|
<div class="mr-4"> |
|
<img |
|
src="{{ url_for('static', filename='uploads/avatars/' + current_user.avatar) if current_user.avatar else url_for('static', filename='uploads/avatars/default.png') }}" |
|
alt="{{ current_user.username }}" |
|
class="w-20 h-20 rounded-full object-cover border border-gray-200" |
|
> |
|
</div> |
|
<div class="flex-1"> |
|
{{ form.avatar(class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-medium file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100") }} |
|
{% if form.avatar.errors %} |
|
<div class="text-red-600 text-sm mt-1"> |
|
{% for error in form.avatar.errors %} |
|
<p>{{ error }}</p> |
|
{% endfor %} |
|
</div> |
|
{% endif %} |
|
<p class="text-gray-500 text-xs mt-1">Allowed formats: JPG, PNG, GIF. Max size: 2MB.</p> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="mb-4"> |
|
<label for="signature" class="block text-gray-700 font-medium mb-2">Signature</label> |
|
{{ form.signature(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="signature", placeholder="Your signature (displayed below your posts)") }} |
|
{% if form.signature.errors %} |
|
<div class="text-red-600 text-sm mt-1"> |
|
{% for error in form.signature.errors %} |
|
<p>{{ error }}</p> |
|
{% endfor %} |
|
</div> |
|
{% endif %} |
|
<p class="text-gray-500 text-xs mt-1">Maximum 200 characters</p> |
|
</div> |
|
|
|
<div class="mb-4"> |
|
<label for="location" class="block text-gray-700 font-medium mb-2">Location</label> |
|
{{ form.location(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="location", placeholder="Your location (city, country)") }} |
|
{% if form.location.errors %} |
|
<div class="text-red-600 text-sm mt-1"> |
|
{% for error in form.location.errors %} |
|
<p>{{ error }}</p> |
|
{% endfor %} |
|
</div> |
|
{% endif %} |
|
</div> |
|
|
|
<div class="mb-4"> |
|
<label for="website" class="block text-gray-700 font-medium mb-2">Website</label> |
|
{{ form.website(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="website", placeholder="https://www.example.com") }} |
|
{% if form.website.errors %} |
|
<div class="text-red-600 text-sm mt-1"> |
|
{% for error in form.website.errors %} |
|
<p>{{ error }}</p> |
|
{% endfor %} |
|
</div> |
|
{% endif %} |
|
</div> |
|
|
|
<div class="mb-6"> |
|
<label for="bio" class="block text-gray-700 font-medium mb-2">About Me</label> |
|
{{ form.bio(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="bio", rows="4", placeholder="Tell us a bit about yourself") }} |
|
{% if form.bio.errors %} |
|
<div class="text-red-600 text-sm mt-1"> |
|
{% for error in form.bio.errors %} |
|
<p>{{ error }}</p> |
|
{% endfor %} |
|
</div> |
|
{% endif %} |
|
<p class="text-gray-500 text-xs mt-1">Maximum 500 characters</p> |
|
</div> |
|
|
|
<div class="flex items-center justify-between"> |
|
<a href="{{ url_for('user.profile', username=current_user.username) }}" 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"> |
|
Save Changes |
|
</button> |
|
</div> |
|
</form> |
|
</div> |
|
</div> |
|
</div> |
|
{% endblock %} |
|
|