feat: implement Phase 3 participant self-management (stories 4.5, 6.1)
Implemented features: - Story 4.5: View Participant List - participants can see other active participants - Story 6.1: Update Profile - participants can edit name and gift ideas before matching - Utility functions for state management and business logic - Comprehensive unit and integration tests New files: - src/utils/participant.py - Business logic utilities - src/templates/participant/profile_edit.html - Profile edit form - tests/unit/test_participant_utils.py - Unit tests for utilities - tests/integration/test_participant_list.py - Integration tests for participant list - tests/integration/test_profile_update.py - Integration tests for profile updates Modified files: - src/routes/participant.py - Added dashboard participant list and profile edit route - src/templates/participant/dashboard.html - Added participant list section and edit link - src/forms/participant.py - Added ProfileUpdateForm - src/app.py - Added participant.profile_edit to setup check exemptions - tests/conftest.py - Added exchange_factory, participant_factory, auth_participant fixtures All tests passing. Phase 3.3 (reminder preferences) and 3.4 (withdrawal) remain to be implemented. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,28 @@
|
||||
<dd>{{ participant.gift_ideas }}</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
|
||||
{% if can_edit_profile %}
|
||||
<a href="{{ url_for('participant.profile_edit') }}">Edit Profile</a>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Participants ({{ participant_count }})</h2>
|
||||
{% if participants %}
|
||||
<ul>
|
||||
{% for p in participants %}
|
||||
<li>
|
||||
{{ p.name }}
|
||||
{% if p.id == participant.id %}
|
||||
<span class="badge">You</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>No other participants yet. Share the registration link!</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
64
src/templates/participant/profile_edit.html
Normal file
64
src/templates/participant/profile_edit.html
Normal file
@@ -0,0 +1,64 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
|
||||
{% block title %}Edit Profile - {{ exchange.name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<article>
|
||||
<header>
|
||||
<h1>Edit Your Profile</h1>
|
||||
<p>Update your display name and gift ideas. Your Secret Santa will see this information after matching.</p>
|
||||
</header>
|
||||
|
||||
<form method="POST" action="{{ url_for('participant.profile_edit') }}">
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
<div>
|
||||
{{ form.name.label }}
|
||||
{{ form.name(class="form-control") }}
|
||||
{% if form.name.errors %}
|
||||
<ul class="field-errors">
|
||||
{% for error in form.name.errors %}
|
||||
<li>{{ error }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<small>{{ form.name.description }}</small>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{ form.gift_ideas.label }}
|
||||
{{ form.gift_ideas(class="form-control") }}
|
||||
{% if form.gift_ideas.errors %}
|
||||
<ul class="field-errors">
|
||||
{% for error in form.gift_ideas.errors %}
|
||||
<li>{{ error }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<small>{{ form.gift_ideas.description }}</small>
|
||||
<small id="gift-ideas-count">
|
||||
{{ (form.gift_ideas.data or '')|length }} / 10,000 characters
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button type="submit">Save Changes</button>
|
||||
<a href="{{ url_for('participant.dashboard', id=exchange.id) }}">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</article>
|
||||
|
||||
<script>
|
||||
// Character counter (progressive enhancement)
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const textarea = document.querySelector('textarea[name="gift_ideas"]');
|
||||
const counter = document.getElementById('gift-ideas-count');
|
||||
|
||||
if (textarea && counter) {
|
||||
textarea.addEventListener('input', function() {
|
||||
counter.textContent = this.value.length + ' / 10,000 characters';
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user