djbrown/hbscorez

View on GitHub
src/leagues/jinja2/leagues/scorers.j2

Summary

Maintainability
Test Coverage
{% extends 'leagues/base.j2' %}
{% block title %}Schützen - {{ super() }}{% endblock %}
{% block description %}Torschützenranking in der Liga '{{ league.name }}' des Bereichs '{{ league.district.name }}
    '{% endblock %}
{% block content %}
    {{ super() }}
    <nav class="nav nav-pills mb-3">
        <a class="nav-item nav-link m-1" href="{{ url('leagues:detail', args=[league.bhv_id]) }}">Übersicht</a>
        <a class="nav-item nav-link m-1" href="{{ url('leagues:teams', args=[league.bhv_id]) }}">Mannschaften</a>
        <a class="nav-item nav-link m-1" href="{{ url('leagues:games', args=[league.bhv_id]) }}">Spiele</a>
        <a class="nav-item nav-link m-1 active" href="#/">Schützen</a>
        <a class="nav-item nav-link m-1" href="{{ url('leagues:offenders', args=[league.bhv_id]) }}">Straffällige</a>
    </nav>
    <h2>Schützen
        <button class="btn btn-outline-primary" type="button" data-bs-toggle="collapse" data-bs-target="#penalty-info"><span
                class="fas fa-info-circle"></span>
        </button>
    </h2>
    <div class="collapse mb-2" id="penalty-info">
        <div class="card card-body">
            Spieler, die keine Tore erzielt haben, werden in der Tabelle nicht angezeigt.
        </div>
    </div>
    <div class="table-responsive">
        <table id="data-table" class="table table-sm table-striped">
            <caption>Schützen</caption>
            <thead>
            <tr>
                <th scope="col">Pl.</th>
                <th scope="col">Name</th>
                <th scope="col">Mannschaft</th>
                <th scope="col">Sp.</th>
                <th scope="col">Tore</th>
                <th scope="col">7m</th>
                <th scope="col">Feldt.</th>
                <th scope="col">Tore &Oslash;</th>
                <th scope="col">Feldt. &Oslash;</th>
            </tr>
            </thead>
            <tbody>
                {% for scorer in scorers %}
                <tr>
                    <th scope="row">{{ scorer.place }}</th>
                    <td><a href="{{ scorer.get_absolute_url() }}">{{ scorer.public_name() }}</a></td>
                    <td>
                        {#<img class="table-team-logo" src="{{ team_logo_url(scorer.team) }}" width="25" alt="HbScorez Logo">#}
                        <img class="table-team-logo" src="{{ static('base/images/favicons/favicon.png') }}" width="25"
                             alt="HbScorez Logo">
                        <a href="{{ scorer.team.get_absolute_url() }}">{{ scorer.team.short_name }}</a>
                    </td>
                    <td>{{ scorer.games }}</td>
                    <td>{{ scorer.total_goals }}</td>
                    <td>{{ scorer.total_penalty_goals }}</td>
                    <td>{{ scorer.total_field_goals }}</td>
                    <td>{{ '%0.2f'| format(scorer.total_goals / scorer.games) }}</td>
                    <td>{{ '%0.2f'| format(scorer.total_field_goals / scorer.games) }}</td>
                </tr>
            {% endfor %}
            </tbody>
            <tfoot>
            <tr>
                <th scope="col">Pl.</th>
                <th scope="col">Name</th>
                <th scope="col">Mannschaft</th>
                <th scope="col">Sp.</th>
                <th scope="col">Tore</th>
                <th scope="col">7m</th>
                <th scope="col">Feldt.</th>
                <th scope="col">Tore &Oslash;</th>
                <th scope="col">Feldt. &Oslash;</th>
            </tr>
            </tfoot>
        </table>
    </div>
{% endblock %}