diff --git a/mo/web/org_round.py b/mo/web/org_round.py index 8e165fd99d703f77f633a7ffd68a3f4cd008ee2b..498cd69e0e45a4a304c2afa51a62a7d10c31ce05 100644 --- a/mo/web/org_round.py +++ b/mo/web/org_round.py @@ -53,7 +53,7 @@ def org_rounds(): return render_template( 'org_rounds.html', - rounds=rounds, participants_count=participants_count, public=public + gk=g.gatekeeper, rounds=rounds, participants_count=participants_count, public=public ) @@ -81,7 +81,7 @@ def org_rounds_history(): ) return render_template('org_rounds.html', - rounds=rounds, participants_count=participants_count, history=True, + gk=g.gatekeeper, rounds=rounds, participants_count=participants_count, history=True, ) diff --git a/mo/web/templates/org_rounds.html b/mo/web/templates/org_rounds.html index fc4a62c1f4cd5812f4d3f56609466712430a3501..d3e90285e21bb5ef2389e688750598cfd9b93f3c 100644 --- a/mo/web/templates/org_rounds.html +++ b/mo/web/templates/org_rounds.html @@ -2,48 +2,80 @@ {% block title %}Soutěžní kola{% endblock %} -{% set ns = namespace(year = 0) %} +{% set ns = namespace(year = 0, category = '') %} {% block body %} {% for r in rounds %} {% if ns.year != r.year %} {% if ns.year != 0 %} - </table> +</div> {% endif %} {% set ns.year = r.year %} - <h3>{{ r.year }}. ročník</h3> - <table class="table table-bordered"> - <thead><tr> - <th>Kategorie - <th>Název - <th>Stav - <th>Počet účastníků - <th>Akce - </thead> + {% set ns.category = '' %} +<h3>{{ r.year }}. ročník</h3><hr> {% endif %} + + {% if ns.category != r.category %} + {% if ns.category != '' %} +</div> + {% endif %} + {% set ns.category = r.category %} +<div class="row"> + <div class="col-sm-12"> + <h4>Kategorie <b>{{ r.category }}</b></h4> + </div> + + {% endif %} + + <div class="col-sm-4"> + <div {% if r.state == RoundState.preparing %} - <tr class="warning"> + class="panel panel-warning" {% elif r.state == RoundState.running %} - <tr class="success"> + class="panel panel-success" {% elif r.state == RoundState.grading %} - <tr class="info"> + class="panel panel-info" {% elif r.state == RoundState.delegate %} - <tr class="active"> + class="panel panel-info" {% else %} - <tr> - {% endif %} - <td class="text-center" style="font-size: 1.2em"><b>{{ r.category }}</b> - <td>{{ r.name }} - <td>{{ r.state.friendly_name() }} - <td>{{ participants_count[r.round_id] if participants_count[r.round_id] else '–' }} - <td> - <a class="btn btn-xs btn-primary" href='{{ url_for('org_round', round_id=r.round_id) }}'>Detail</a> - <a class="btn btn-xs btn-default" href='{{ url_for('org_generic_list', round_id=r.round_id) }}'>Účastníci</a> - {% if r.state == RoundState.closed %} - <a class="btn btn-xs btn-default" href='{{ url_for('org_score', round_id=r.round_id) }}'>Výsledky</a> + class="panel panel-default" + {% endif %}> + <div class="panel-heading"> + <small class="pull-right">{{ r.state.friendly_name() }}</small> + <h5 class="panel-title">{{ r.name }} <b>{{ r.category }}</b></h5> + </div> + <div class="panel-body"> + <a class="btn btn-sm btn-primary" href='{{ url_for('org_round', round_id=r.round_id) }}'> + <span class="glyphicon glyphicon-search"></span> + Detail + </a> + <a class="btn btn-sm btn-default" href='{{ url_for('org_generic_list', round_id=r.round_id) }}'> + <span class="glyphicon glyphicon-user"></span> + Účastníci + {%if participants_count[r.round_id] %} + <span class="badge">{{ participants_count[r.round_id] }}</span> {% endif %} - </td> + </a> + {% if r.state == RoundState.closed %} + <a class="btn btn-sm btn-warning" href='{{ url_for('org_score', round_id=r.round_id) }}'> + <span class="glyphicon glyphicon-bullhorn"></span> + Výsledky + </a> + {% endif %} + </div> + <div class="panel-footer"> + {% if gk.rights_for_round(r).have_right(Right.manage_round) %} + <a class="btn btn-xs btn-default pull-right" href='{{ url_for('org_round_edit', round_id=r.round_id) }}'> + <span class="glyphicon glyphicon-cog"></span> + Nastavení + </a> + {% endif %} + <span class="glyphicon glyphicon-time"></span> + {{ r.ct_submit_end|timeformat_date|none_value('Termín nezadán') }} + </div> + </div> + </div> {% endfor %} - </table> +</div> {% if history %} <p><a class='btn btn-default' href='{{ url_for('org_rounds') }}'>Aktuální ročník</a>