phase4: implement player search filters, htmx results, and detail page
This commit is contained in:
82
templates/players/partials/results.html
Normal file
82
templates/players/partials/results.html
Normal file
@ -0,0 +1,82 @@
|
||||
{% load player_query %}
|
||||
|
||||
<div class="row-between wrap-gap">
|
||||
<h2>Results</h2>
|
||||
<div class="muted-text">
|
||||
{{ page_obj.paginator.count }} player{{ page_obj.paginator.count|pluralize }} found
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if players %}
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Player</th>
|
||||
<th>Nationality</th>
|
||||
<th>Pos / Role</th>
|
||||
<th>Height / Weight</th>
|
||||
<th>Games</th>
|
||||
<th>MPG</th>
|
||||
<th>PPG</th>
|
||||
<th>RPG</th>
|
||||
<th>APG</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for player in players %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'players:detail' player.pk %}">{{ player.full_name }}</a>
|
||||
</td>
|
||||
<td>{{ player.nationality.name|default:"-" }}</td>
|
||||
<td>
|
||||
{{ player.nominal_position.code|default:"-" }}
|
||||
/ {{ player.inferred_role.name|default:"-" }}
|
||||
</td>
|
||||
<td>{{ player.height_cm|default:"-" }} / {{ player.weight_kg|default:"-" }}</td>
|
||||
<td>{{ player.games_played_value|floatformat:0 }}</td>
|
||||
<td>{{ player.mpg_value|floatformat:1 }}</td>
|
||||
<td>{{ player.ppg_value|floatformat:1 }}</td>
|
||||
<td>{{ player.rpg_value|floatformat:1 }}</td>
|
||||
<td>{{ player.apg_value|floatformat:1 }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination row-gap mt-16">
|
||||
{% if page_obj.has_previous %}
|
||||
{% query_transform page=page_obj.previous_page_number as prev_query %}
|
||||
<a
|
||||
class="button ghost"
|
||||
href="?{{ prev_query }}"
|
||||
hx-get="?{{ prev_query }}"
|
||||
hx-target="#player-results"
|
||||
hx-swap="innerHTML"
|
||||
hx-push-url="true"
|
||||
>
|
||||
Previous
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<span>Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</span>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
{% query_transform page=page_obj.next_page_number as next_query %}
|
||||
<a
|
||||
class="button ghost"
|
||||
href="?{{ next_query }}"
|
||||
hx-get="?{{ next_query }}"
|
||||
hx-target="#player-results"
|
||||
hx-swap="innerHTML"
|
||||
hx-push-url="true"
|
||||
>
|
||||
Next
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p>No players matched the current filters.</p>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user