Skip to content

Commit 623a537

Browse files
committed
Disable diff selection if there is no other
Also, do not store the preferred diff tag when there is no other diff. This prevents going back to no-diff after viewing a submission without a diff.
1 parent 3934d99 commit 623a537

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

webapp/public/js/domjudge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ function initDiffEditor(editorId) {
14221422
});
14231423

14241424
const selected = select[0].options[select[0].selectedIndex];
1425-
if (selected && selected.dataset.tag) {
1425+
if (!select[0].disabled && selected && selected.dataset.tag) {
14261426
setDiffTag(selected.dataset.tag);
14271427
}
14281428

webapp/templates/jury/partials/submission_diff.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{% endif %}
2727
<div class="btn-group">
2828
<a href="#" role="button" class="btn btn-secondary btn-sm pe-none" aria-disabled="true"><i class="fas fa-code-branch"></i></a>
29-
<select class="diff-select btn btn-secondary btn-sm form-select-sm text-start" aria-label="Submission to diff against">
29+
<select class="diff-select btn btn-secondary btn-sm form-select-sm text-start" aria-label="Submission to diff against" {%- if otherSubmissions is empty %}disabled="true" aria-disabled="true"{%- endif %}>
3030
<option value="" data-tag="no-diff">No diff</option>
3131
{%- for other in otherSubmissions %}
3232
<option value="{{ other.submitid }}" data-url="{{ path('jury_submission', {submitId: other.submitid}) }}" {%- if other.tag %} data-tag="{{ other.tag }}" {%- endif %}>

0 commit comments

Comments
 (0)