From f416e75091f1d314f947645776e6608146a8601e Mon Sep 17 00:00:00 2001
From: Jiri Kalvoda <jirikalvoda@kam.mff.cuni.cz>
Date: Mon, 26 Jul 2021 15:59:14 +0200
Subject: [PATCH] =?UTF-8?q?P=C5=99id=C3=A1ny=20odkazy=20na=20p=C5=99id?=
 =?UTF-8?q?=C3=A1n=C3=AD=20=C3=BA=C4=8Dastn=C3=ADka?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 mo/web/templates/org_contest.html             | 19 +++++++++++++++++--
 .../parts/org_participants_table_actions.html |  5 ++++-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/mo/web/templates/org_contest.html b/mo/web/templates/org_contest.html
index 36eb3b62..485ffd92 100644
--- a/mo/web/templates/org_contest.html
+++ b/mo/web/templates/org_contest.html
@@ -49,6 +49,9 @@
 	{% if state != RoundState.preparing %}
 	<a class="btn btn-primary" href='{{ url_for('org_contest_solutions', id=contest.contest_id, site_id=site_id) }}'>Odevzdaná řešení</a>
 	{% endif %}
+	{% if can_manage and site %}
+	<a class="btn btn-default" href="{{ url_for('org_contest_add_user', id=contest.contest_id, site_id=site_id) }}">Přidat účastníka</a>
+	{% endif %}
 	{% if not site %}
 	{% if state in [RoundState.grading, RoundState.closed] %}
 	<a class="btn btn-primary" href='{{ url_for('org_score', contest_id=contest.contest_id) }}'>Výsledky</a>
@@ -73,25 +76,37 @@
 {% if places_counts %}
 <table class=data>
 	<thead>
-		<tr><th>Místo<th>Počet účastníků
+		<tr><th>Místo<th>Počet účastníků<th>Akce
 	</thead>
 	{% for (place, count) in places_counts %}
 		<tr>
 			<td><a href="{{ url_for('org_contest', id=contest.contest_id, site_id=place.place_id) }}">{{ place.name }}</a>
 			<td>{{ count }}
+			<td><div class="btn-group">
+				<a class="btn btn-xs btn-primary" href="{{ url_for('org_contest', id=contest.contest_id, site_id=place.place_id) }}">Detail</a>
+				{% if can_manage %}
+				<a class="btn btn-xs btn-default" href="{{ url_for('org_contest_add_user', id=contest.contest_id, site_id=place.place_id) }}">Přidat účastníka</a>
+			</div>
+				{% endif %}
 		</tr>
 	{% endfor %}
 	<tfoot>
 		<tr>
 			<th>Celkem
 			<th>{{ places_counts|sum(attribute=1) }}
+			<th>
 		</tr>
 	</tfoot>
 </table>
 {% else %}
-<i>Žádní účastníci a žádná soutěžní místa.</i>
+<p><i>Žádní účastníci a žádná soutěžní místa.</i></p>
 {% endif %}
 {% endif %}
+<div class="btn-group">
+	{% if can_manage and not site %}
+	<a class="btn btn-default" href='{{ url_for('org_contest_add_user', id=contest.contest_id) }}'>Přidat účastníka</a>
+	{% endif %}
+</div>
 
 <h3>Úlohy</h3>
 {% if tasks %}
diff --git a/mo/web/templates/parts/org_participants_table_actions.html b/mo/web/templates/parts/org_participants_table_actions.html
index 24eb85aa..0eec0d02 100644
--- a/mo/web/templates/parts/org_participants_table_actions.html
+++ b/mo/web/templates/parts/org_participants_table_actions.html
@@ -4,7 +4,10 @@
 
 	{{ table.to_html() }}
 
-	<a class="btn btn-primary pull-right"
+	{% if contest %}
+	<a class="btn btn-primary" href="{{ url_for('org_contest_add_user', id=contest.contest_id, site_id=site.place_id if site else None) }}">Přidat účastníka</a>
+	{% endif %}
+	<a class="btn btn-default"
 	   title="Zobrazí emailové adresy ve snadno zkopírovatelném formátu"
 	   href="{{ url_for('org_contest_list_emails', id=id, site_id=site_id, **request.args) if contest else url_for('org_round_list_emails', id=id, **request.args) }}">
 		Vypsat e-mailové adresy
-- 
GitLab