djbrown/hbscorez

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

Summary

Maintainability
Test Coverage
{% extends 'leagues/base.j2' %}
{% block title %}Straffällige - {{ super() }}{% endblock %}
{% block description %}Ranking der straffälligsten Spieler in der Liga {{ league.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" href="{{ url('leagues:scorers', args=[league.bhv_id]) }}">Schützen</a>
        <a class="nav-item nav-link m-1 active" href="#/">Straffällige</a>
    </nav>
    <h2>Straffällige
        <button class="btn btn-outline-primary" type="button" data-bs-toggle="collapse" data-bs-target="#offender-info"><span
                class="fas fa-info-circle"></span>
        </button>
    </h2>
    <div class="collapse mb-2" id="offender-info">
        <div class="card card-body">
            Bei der Berechnung der Punktezahl werden Gelbe Karten einfach, 2-Minuten doppelt und Rote Karten dreifach
            aufaddiert.<br/>
            Spieler, die keine Strafe erhalten haben, werden in der Tabelle nicht angezeigt.
        </div>
    </div>
    <div class="table-responsive">
        <table id="data-table" class="table table-sm table-striped">
            <caption>Straffällige</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">Pkt.</th>
                <th scope="col">Gelb</th>
                <th scope="col">2min</th>
                <th scope="col">Rot</th>
            </tr>
            </thead>
            <tbody>
            {% for offender in offenders %}
                <tr>
                    <th scope="row">{{ offender.place }}</th>
                    <td><a href="{{ offender.get_absolute_url() }}">{{ offender.public_name() }}</a></td>
                    <td>
                        {#<img class="table-team-logo" src="{{ team_logo_url(offender.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="{{ offender.team.get_absolute_url() }}">{{ offender.team.short_name }}</a>
                    </td>
                    <td>{{ offender.games }}</td>
                    <td>{{ offender.offender_points }}</td>
                    <td>{{ offender.warnings }}</td>
                    <td>{{ offender.suspensions }}</td>
                    <td>{{ offender.disqualifications }}</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">Pkt.</th>
                <th scope="col">Gelb</th>
                <th scope="col">2min</th>
                <th scope="col">Rot</th>
            </tr>
            </tfoot>
        </table>
    </div>
{% endblock %}