Skip to content

Commit 5c0546e

Browse files
committed
Refer to domjudge.org documentation in case docs are missing
Before we always generated the URL even when docs were not configured. This resulted in a 404.
1 parent a4d207a commit 5c0546e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

webapp/src/Controller/Jury/JuryMiscController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,15 @@ public function indexAction(ConfigurationService $config): Response
6464
$this->addFlash('info', 'New release ' . $newestVersion . ' available at: https://www.domjudge.org/download.');
6565
}
6666

67+
$assetUrls = [];
68+
foreach(['domjudge_manual' => ['doc/manual/html/index.html', 'docs/manual/index.html'], 'team_manual' => ['doc/manual/domjudge-team-manual.pdf', 'docs/manual/team.html']] as $key => $file) {
69+
$assetUrls[$key] = file_exists($this->dj->getDomjudgeWebappDir() . '/public' . $file[0]) ? asset($file[0]) : 'https://domjudge.org/' . $file[1];
70+
};
71+
6772
return $this->render('jury/index.html.twig', [
6873
'adminer_enabled' => $config->get('adminer_enabled'),
6974
'CCS_SPEC_API_URL' => GI::CCS_SPEC_API_URL,
75+
'asset_urls' => $assetUrls,
7076
]);
7177
}
7278

webapp/templates/jury/index.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
</div>
104104
<div class="card-body">
105105
<ul>
106-
<li><a href="{{ asset('doc/manual/html/index.html') }}">DOMjudge manual</a></li>
107-
<li><a href="{{ asset('doc/manual/domjudge-team-manual.pdf') }}">Team manual <i class="fas fa-file-pdf"></i></a></li>
106+
<li><a href="{{ asset_urls['domjudge_manual'] }}">DOMjudge manual</a></li>
107+
<li><a href="{{ asset_urls['team_manual'] }}">Team manual <i class="fas fa-file-pdf"></i></a></li>
108108
<li><a href="{{ path('app.swagger_ui') }}">API documentation</a><br />
109109
See also the <a href="{{ CCS_SPEC_API_URL }}">ICPC Contest API</a>.</li>
110110
</ul>

0 commit comments

Comments
 (0)