working FileIndex and user Profile pages/settings
This commit is contained in:
@@ -48,20 +48,21 @@
|
||||
<div class="user-bar">
|
||||
<div class="user-avatar" onclick="toggleUserMenu()">
|
||||
{% if user.userprofile.avatar %}
|
||||
<img src="{{ user.userprofile.avatar.url }}" alt="Avatar">
|
||||
<img src="{{ user.userprofile.avatar_url }}" alt="Avatar">
|
||||
{% else %}
|
||||
<div class="default-avatar">{{ user.username|first|upper }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="user-menu" id="user-menu">
|
||||
{# TODO: wire edit profile page when it exists #}
|
||||
<a href="{% url 'profiles:settings' %}" class="user-edit">
|
||||
<a href="{% url 'profiles:user_profile' request.user.username %}" class="user-edit">
|
||||
<i class="fas fa-user-circle"></i> {{ user.username }}
|
||||
</a>
|
||||
<div class="user-info"></div>
|
||||
{# TODO: wire upload / library pages when they exist #}
|
||||
<a href="{% url 'profiles:account' %}">
|
||||
<i class="fas fa-user-cog"></i> Account Settings
|
||||
</a>
|
||||
<a href="{% url 'profiles:settings' %}">
|
||||
<i class="fas fa-cog"></i> Settings
|
||||
<i class="fas fa-key"></i> API Tokens
|
||||
</a>
|
||||
<form method="post" action="{% url 'profiles:logout' %}" style="display: inline;">
|
||||
{% csrf_token %}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Account Settings - Packs{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Account Settings</h1>
|
||||
<p><a href="{% url 'profiles:settings' %}"><i class="fas fa-key"></i> Manage API tokens</a></p>
|
||||
|
||||
{% if messages %}
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<div class="account-grid">
|
||||
<section class="card account-card">
|
||||
<h2><i class="fas fa-user"></i> Username</h2>
|
||||
<p class="account-current">Current: <strong>{{ request.user.username }}</strong></p>
|
||||
<form method="post" action="{% url 'profiles:account' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="username">
|
||||
<div class="form-group">
|
||||
{{ username_form.username.errors }}
|
||||
<label for="{{ username_form.username.id_for_label }}">New username</label>
|
||||
{{ username_form.username }}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Change username</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card account-card">
|
||||
<h2><i class="fas fa-envelope"></i> Email</h2>
|
||||
<p class="account-current">Current: <strong>{{ request.user.email|default:"none" }}</strong></p>
|
||||
<form method="post" action="{% url 'profiles:account' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="email">
|
||||
<div class="form-group">
|
||||
{{ email_form.email.errors }}
|
||||
<label for="{{ email_form.email.id_for_label }}">Email (optional — leave empty to clear)</label>
|
||||
{{ email_form.email }}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Update email</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card account-card">
|
||||
<h2><i class="fas fa-lock"></i> Password</h2>
|
||||
<form method="post" action="{% url 'profiles:account' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="password">
|
||||
{% for field in password_form %}
|
||||
<div class="form-group">
|
||||
{{ field.errors }}
|
||||
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||
{{ field }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary">Change password</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card account-card">
|
||||
<h2><i class="fas fa-image"></i> Profile picture</h2>
|
||||
<div class="avatar-preview">
|
||||
{% if request.user.userprofile.avatar %}
|
||||
<img src="{{ request.user.userprofile.avatar_url }}" alt="Current avatar">
|
||||
{% else %}
|
||||
<div class="default-avatar large">{{ request.user.username|first|upper }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<form method="post" action="{% url 'profiles:account' %}" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="avatar">
|
||||
<div class="form-group">
|
||||
{{ avatar_form.avatar.errors }}
|
||||
<label for="{{ avatar_form.avatar.id_for_label }}">{{ avatar_form.avatar.label }}</label>
|
||||
{{ avatar_form.avatar }}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Upload picture</button>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,69 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ profile_user.username }} - Packs{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="profile-header card">
|
||||
<div class="profile-avatar">
|
||||
{% if profile.avatar %}
|
||||
<img src="{{ profile.avatar_url }}" alt="{{ profile_user.username }} avatar">
|
||||
{% else %}
|
||||
<div class="default-avatar large">{{ profile_user.username|first|upper }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="profile-info">
|
||||
<h1>{{ profile_user.username }}</h1>
|
||||
<p class="profile-joined"><i class="fas fa-calendar"></i> Joined {{ profile.joined|date:"F j, Y" }}</p>
|
||||
{% if is_owner %}
|
||||
<p><a href="{% url 'profiles:account' %}" class="btn btn-secondary"><i class="fas fa-cog"></i> Account Settings</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="card profile-section">
|
||||
<h2><i class="fas fa-comment"></i> Bio</h2>
|
||||
{% if is_owner %}
|
||||
{% if messages %}
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<form method="post" action="{% url 'profiles:user_profile' profile_user.username %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="bio">
|
||||
<div class="form-group">
|
||||
{{ bio_form.bio.errors }}
|
||||
{{ bio_form.bio }}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Save bio</button>
|
||||
</form>
|
||||
{% else %}
|
||||
{% if profile.bio %}
|
||||
<p class="profile-bio">{{ profile.bio }}</p>
|
||||
{% else %}
|
||||
<p class="profile-bio-empty"><i class="fas fa-user"></i> {{ profile_user.username }} hasn't written a bio yet.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<section class="home-section">
|
||||
<div class="home-section-header">
|
||||
<h2>Packs by {{ profile_user.username }}</h2>
|
||||
</div>
|
||||
<div class="pack-grid">
|
||||
{% comment %} Placeholder — replace with real Pack objects when the library model lands. {% endcomment %}
|
||||
<div class="pack-card pack-card-empty">
|
||||
<div class="pack-card-thumb">
|
||||
<i class="fas fa-box-open"></i>
|
||||
</div>
|
||||
<div class="pack-card-body">
|
||||
<h3>No packs yet</h3>
|
||||
<p class="pack-card-desc">This creator hasn't published any datapacks.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -1,9 +1,10 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Settings - Packs{% endblock %}
|
||||
{% block title %}API Tokens - Packs{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Settings</h1>
|
||||
<h1>API Tokens</h1>
|
||||
<p><a href="{% url 'profiles:account' %}"><i class="fas fa-user-cog"></i> Account Settings</a></p>
|
||||
|
||||
{% if messages %}
|
||||
<ul class="messages">
|
||||
@@ -13,7 +14,7 @@
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<h2>API Tokens</h2>
|
||||
<h2>Tokens</h2>
|
||||
<p>Tokens let non-browser clients (like a Fabric mod) access the API and download packs.</p>
|
||||
<p class="token-hint">
|
||||
Send credentials as <code>Authorization: Bearer <username> <token></code>,
|
||||
|
||||
Reference in New Issue
Block a user