Skip to content

Commit 30abfc9

Browse files
committed
Apply consistent spacing to variables in twig.
No functional changes intended.
1 parent d5d9d99 commit 30abfc9

15 files changed

+86
-86
lines changed

webapp/templates/base.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
{% block extrahead %}
2222
<link rel="stylesheet" href="{{ asset('style_domjudge.css') }}">
2323

24-
{{ extrahead|default('') }}
24+
{{ extrahead | default('') }}
2525
{% endblock %}
2626
{% for file in customAssetFiles('css') %}
2727
<link rel="stylesheet" href="{{ asset('css/custom/' ~ file) }}">
2828
{% endfor %}
2929
</head>
30-
<body{% if static is defined and static %} class="static"{% endif%}>
30+
<body{% if static is defined and static %} class="static"{% endif %}>
3131
{% block menu %}{% endblock %}
3232
{% block body %}
3333
<div class="container-fluid">
@@ -36,7 +36,7 @@
3636
{% block messages %}
3737
{% include 'partials/messages.html.twig' %}
3838
{% endblock %}
39-
{% block content %}{{ body|raw }}{% endblock %}
39+
{% block content %}{{ body | raw }}{% endblock %}
4040
</div>
4141
</div>
4242
</div>

webapp/templates/form_theme.html.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{% use 'bootstrap_5_layout.html.twig' %}
22

33
{% block choice_widget_collapsed -%}
4-
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control form-select')|trim}) -%}
4+
{%- set attr = attr | merge({class: (attr.class | default('') ~ ' form-control form-select') | trim}) -%}
55
{{- parent() -}}
66
{%- endblock choice_widget_collapsed %}
77

88
{% block button_widget -%}
9-
{% set attr = attr|merge({class: (attr.class|default('') ~ ' btn')|trim}) %}
9+
{% set attr = attr | merge({class: (attr.class | default('') ~ ' btn') | trim}) %}
1010
{% if label is empty -%}
1111
{%- if label_format is not empty -%}
12-
{% set label = label_format|replace({
12+
{% set label = label_format | replace({
1313
'%name%': name,
1414
'%id%': id,
1515
}) %}
1616
{%- else -%}
17-
{% set label = name|humanize %}
17+
{% set label = name | humanize %}
1818
{%- endif -%}
1919
{%- endif -%}
20-
{% if icon|default %}
20+
{% if icon | default %}
2121
{% set iconHtml = '<i class="fa ' ~ icon ~ '"></i> ' %}
2222
{% else %}
2323
{% set iconHtml = '' %}
2424
{% endif %}
25-
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ iconHtml|raw }}{{ label|trans({}, translation_domain) }}</button>
25+
<button type="{{ type | default('button') }}" {{ block('button_attributes') }}>{{ iconHtml | raw }}{{ label | trans({}, translation_domain) }}</button>
2626
{%- endblock button_widget %}
2727

2828
{% block form_widget_simple %}

webapp/templates/jury/analysis/contest_overview.html.twig

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
{% block extrahead %}
66
{{ parent() }}
7-
<link rel="stylesheet" href="{{asset('css/nv.d3.min.css')}}">
8-
<script src="{{asset('js/d3.min.js')}}"></script>
9-
<script src="{{asset('js/nv.d3.min.js')}}"></script>
10-
<script src="{{asset('js/FileSaver.min.js')}}"></script>
7+
<link rel="stylesheet" href="{{ asset('css/nv.d3.min.css') }}">
8+
<script src="{{ asset('js/d3.min.js') }}"></script>
9+
<script src="{{ asset('js/nv.d3.min.js') }}"></script>
10+
<script src="{{ asset('js/FileSaver.min.js') }}"></script>
1111
<style>
1212
.card-body.tablecard{
1313
overflow-y: auto;
@@ -50,9 +50,9 @@ $(function() {
5050
<br>
5151
Calculated as:<br>
5252
average across all teams of [3 people x (number of minutes elapsed - minute last problem solved by team t)]
53-
">Misery index</abbr>: {{misc.misery_index|number_format(0)}} minutes<br>
53+
">Misery index</abbr>: {{ misc.misery_index | number_format(0) }} minutes<br>
5454
# Submissions: {{ misc.total_submissions }}<br>
55-
# Accepted Submissions: {{ misc.total_accepted }} <span class="text-muted">(~{{ (misc.total_submissions>0 ? (misc.total_accepted/misc.total_submissions)*100:0)|number_format(0) }}%)</span><br>
55+
# Accepted Submissions: {{ misc.total_accepted }} <span class="text-muted">(~{{ (misc.total_submissions>0 ? (misc.total_accepted/misc.total_submissions)*100:0) | number_format(0) }}%)</span><br>
5656
# of Teams: {{ misc.num_teams }}<br>
5757
</div>
5858
</div>
@@ -116,13 +116,13 @@ $(function() {
116116
{% set id=p.probid %}
117117
<tr>
118118
{% set link = path('analysis_problem', {'probid': id, 'view': view}) %}
119-
<td scope="row"><a href="{{path('analysis_problem', {'probid': id, 'view': view}) }}">{{ id }}</a></td>
119+
<td scope="row"><a href="{{ path('analysis_problem', {'probid': id, 'view': view}) }}">{{ id }}</a></td>
120120
<td><a href="{{ link }}">{{ p | problemBadge }} {{ p.problem.name }}</a></td>
121121
<td><a href="{{ link }}">{{ p.problem.timelimit }}</a></td>
122-
<td><a href="{{ link }}">{{ p.problem.memlimit|default('default') }}</a></td>
122+
<td><a href="{{ link }}">{{ p.problem.memlimit | default('default') }}</a></td>
123123
<td><a href="{{ link }}">{{ misc.problem_num_testcases[id] }}</a></td>
124-
<td><a href="{{ link }}">{{ misc.problem_attempts[id]|default(0) }} / {{ misc.problem_solutions[id]|default(0) }}</a></td>
125-
<td><a href="{{ link }}">{{ misc.problem_stats.teams_attempted[id]|default([])|length }} / {{ misc.problem_stats.teams_solved[id]|default([])|length }}</a></td>
124+
<td><a href="{{ link }}">{{ misc.problem_attempts[id] | default(0) }} / {{ misc.problem_solutions[id] | default(0) }}</a></td>
125+
<td><a href="{{ link }}">{{ misc.problem_stats.teams_attempted[id] | default([]) | length }} / {{ misc.problem_stats.teams_solved[id] | default([]) | length }}</a></td>
126126
</tr>
127127
{% endfor %}
128128
</tbody>
@@ -156,8 +156,8 @@ $(function() {
156156
<td><a href="{{ link }}">{% if t.affiliation %}{{ t.affiliation.name }}{% else %}-{% endif %}</a></td>
157157
<td class="truncate" style="max-width: 200px"><a href="{{ link }}">{{ t.effectiveName }}</a></td>
158158
<td><a href="{{ link }}">{{ misc.team_stats[id].total_submitted }} / {{ misc.team_stats[id].total_accepted }}</a></td>
159-
<td><a href="{{ link }}">{{ misc.team_stats[id].problems_submitted|length }} / {{ misc.team_stats[id].problems_accepted|length }}</a></td>
160-
<td><a href="{{ link }}">{{ misc.team_stats[id].misery_index|number_format(0) }}</a></td>
159+
<td><a href="{{ link }}">{{ misc.team_stats[id].problems_submitted | length }} / {{ misc.team_stats[id].problems_accepted | length }}</a></td>
160+
<td><a href="{{ link }}">{{ misc.team_stats[id].misery_index | number_format(0) }}</a></td>
161161
</tr>
162162
{% endfor %}
163163
</tbody>
@@ -173,7 +173,7 @@ $(function() {
173173
Delayed Judgings (by more than {{ delayed_judgings.delay }}s)
174174
</div>
175175
<div class="card-body tablecard">
176-
{% if delayed_judgings.data|length > 0 %}
176+
{% if delayed_judgings.data | length > 0 %}
177177
<table class="table table-sm table-striped table-hover table-full-clickable-cell">
178178
<thead>
179179
<tr>
@@ -235,7 +235,7 @@ var language_stats = [
235235
values: [
236236
{% for lang,count in misc.language_stats.total_submissions %}
237237
{
238-
"label" : "{{lang}}",
238+
"label" : "{{ lang }}",
239239
"value" : {{ count }},
240240
},
241241
{% endfor %}
@@ -247,7 +247,7 @@ var language_stats = [
247247
values: [
248248
{% for lang,count in misc.language_stats.total_solutions %}
249249
{
250-
"label" : "{{lang}}",
250+
"label" : "{{ lang }}",
251251
"value" : {{ count }},
252252
},
253253
{% endfor %}
@@ -288,8 +288,8 @@ var problem_stats = [
288288
values: [
289289
{% for prob in problems %}
290290
{
291-
"label" : "{{prob.shortname}}",
292-
"value" : {{ misc.problem_stats.teams_attempted[prob.probid]|default([])|length }},
291+
"label" : "{{ prob.shortname }}",
292+
"value" : {{ misc.problem_stats.teams_attempted[prob.probid] | default([]) | length }},
293293
},
294294
{% endfor %}
295295
]
@@ -300,8 +300,8 @@ var problem_stats = [
300300
values: [
301301
{% for prob in problems %}
302302
{
303-
"label" : "{{prob.shortname}}",
304-
"value" : {{ misc.problem_stats.teams_solved[prob.probid]|default([])|length }},
303+
"label" : "{{ prob.shortname }}",
304+
"value" : {{ misc.problem_stats.teams_solved[prob.probid] | default([]) | length }},
305305
},
306306
{% endfor %}
307307
]
@@ -344,8 +344,8 @@ nv.addGraph(function() {
344344
const submission_stats = [
345345
{% for result in ['correct', 'wrong-answer', 'timelimit', 'run-error', 'compiler-error', 'no-output'] %}
346346
{
347-
key: "{{result}}",
348-
color: "{{colors[result]}}",
347+
key: "{{ result }}",
348+
color: "{{ colors[result] }}",
349349
values: []
350350
},
351351
{% endfor %}

webapp/templates/jury/analysis/problem.html.twig

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
{% block extrahead %}
66
{{ parent() }}
7-
<link rel="stylesheet" href="{{asset('css/nv.d3.min.css')}}">
8-
<script src="{{asset('js/d3.min.js')}}"></script>
9-
<script src="{{asset('js/nv.d3.min.js')}}"></script>
10-
<script src="{{asset('js/FileSaver.min.js')}}"></script>
7+
<link rel="stylesheet" href="{{ asset('css/nv.d3.min.css') }}">
8+
<script src="{{ asset('js/d3.min.js') }}"></script>
9+
<script src="{{ asset('js/nv.d3.min.js') }}"></script>
10+
<script src="{{ asset('js/FileSaver.min.js') }}"></script>
1111
<style>
1212
.row.equal {
1313
display: flex;
@@ -31,16 +31,16 @@
3131
<div class="card-body">
3232
<dl class="row">
3333
<dt class="col-sm-6"># Submissions</dt>
34-
<dd class="col-sm-6">{{ submissions|length }}</dd>
34+
<dd class="col-sm-6">{{ submissions | length }}</dd>
3535

3636
<dt class="col-sm-6"># Correct</dt>
37-
<dd class="col-sm-6">{{ results['correct']|default(0) }} <span class="text-muted">({{ misc.correct_percentage|number_format(2) }}%)</span></dd>
37+
<dd class="col-sm-6">{{ results['correct'] | default(0) }} <span class="text-muted">({{ misc.correct_percentage | number_format(2) }}%)</span></dd>
3838

3939
<dt class="col-sm-6"># Teams Attempted</dt>
4040
<dd class="col-sm-6">{{ misc.num_teams_attempted }}</dd>
4141

4242
<dt class="col-sm-6"># Teams Correct</dt>
43-
<dd class="col-sm-6">{{misc.num_teams_correct}} <span class="text-muted">({{ misc.teams_correct_percentage|number_format(2) }}%)</dd>
43+
<dd class="col-sm-6">{{ misc.num_teams_correct }} <span class="text-muted">({{ misc.teams_correct_percentage | number_format(2) }}%)</dd>
4444
</dl>
4545
</div>
4646
</div>
@@ -163,9 +163,9 @@ $(function(){
163163
line = d3.select('#maxruntime svg #maxline')
164164
.attr({
165165
x1: chart.margin().left,
166-
y1: chart.yAxis.scale()({{timelimit}})+ chart.margin().top,
166+
y1: chart.yAxis.scale()({{ timelimit }})+ chart.margin().top,
167167
x2: +svgsize - chart.margin().right,
168-
y2: chart.yAxis.scale()({{timelimit}}) + chart.margin().top,
168+
y2: chart.yAxis.scale()({{ timelimit }}) + chart.margin().top,
169169
})
170170
}
171171
updateline();
@@ -184,7 +184,7 @@ $(function(){
184184
values: [
185185
{% for result,count in results %}
186186
{
187-
"label" : "{{result}}",
187+
"label" : "{{ result }}",
188188
"value" : {{ count }},
189189
"color" : "{{ colors[result] }}",
190190
},
@@ -218,8 +218,8 @@ $(function(){
218218
const submission_stats = [
219219
{% for result in ['correct', 'wrong-answer', 'timelimit', 'run-error', 'compiler-error', 'no-output'] %}
220220
{
221-
key: "{{result}}",
222-
color: "{{colors[result]}}",
221+
key: "{{ result }}",
222+
color: "{{ colors[result] }}",
223223
values: []
224224
},
225225
{% endfor %}

webapp/templates/jury/analysis/team.html.twig

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
{% block extrahead %}
66
{{ parent() }}
7-
<link rel="stylesheet" href="{{asset('css/nv.d3.min.css')}}">
8-
<script src="{{asset('js/d3.min.js')}}"></script>
9-
<script src="{{asset('js/nv.d3.min.js')}}"></script>
10-
<script src="{{asset('js/FileSaver.min.js')}}"></script>
7+
<link rel="stylesheet" href="{{ asset('css/nv.d3.min.css') }}">
8+
<script src="{{ asset('js/d3.min.js') }}"></script>
9+
<script src="{{ asset('js/nv.d3.min.js') }}"></script>
10+
<script src="{{ asset('js/FileSaver.min.js') }}"></script>
1111
<style>
1212
.row.equal {
1313
display: flex;
@@ -35,10 +35,10 @@
3535
<div class="card-body">
3636
<dl class="row">
3737
<dt class="col-sm-6"># Submissions</dt>
38-
<dd class="col-sm-6">{{ submissions|length }}</dd>
38+
<dd class="col-sm-6">{{ submissions | length }}</dd>
3939

4040
<dt class="col-sm-6"># Correct</dt>
41-
<dd class="col-sm-6">{{ results['correct']|default(0) }} <span class="text-muted">({{ misc.correct_percentage|number_format(2) }}%)</span></dd>
41+
<dd class="col-sm-6">{{ results['correct'] | default(0) }} <span class="text-muted">({{ misc.correct_percentage | number_format(2) }}%)</span></dd>
4242
</dl>
4343
</div>
4444
</div>
@@ -66,7 +66,7 @@
6666
</div>
6767
<div class="row equal">
6868
{% for problem in problems %}
69-
<div class="col-3 mt-3" id="maxruntime_{{problem.probid}}">
69+
<div class="col-3 mt-3" id="maxruntime_{{ problem.probid }}">
7070
<div class="card">
7171
<div class="card-header">
7272
Max Runtimes for problem {{ problem.name }}
@@ -97,7 +97,7 @@ set colors = {
9797
$(function(){
9898
9999
{% for problem in problems %}
100-
var run_max_times_{{problem.probid}} = [
100+
var run_max_times_{{ problem.probid }} = [
101101
{
102102
key: "Max Runtimes",
103103
values: [
@@ -120,7 +120,7 @@ $(function(){
120120
.x(function(d) { return d.label })
121121
.y(function(d) { return d.value })
122122
.valueFormat(d3.format('.3f'))
123-
.staggerLabels(run_max_times_{{problem.probid}}[0].values.length > 10)
123+
.staggerLabels(run_max_times_{{ problem.probid }}[0].values.length > 10)
124124
.showValues(false)
125125
.forceY([0, {{ problem.timelimit*1.20 }}])
126126
.margin({bottom: 90})
@@ -132,8 +132,8 @@ $(function(){
132132
.tickFormat(d3.format('.3f'))
133133
.axisLabel('Runtime(in s)');
134134
chart.xAxis.axisLabel("Judgings");
135-
d3.select('#maxruntime_{{problem.probid}} svg')
136-
.datum(run_max_times_{{problem.probid}})
135+
d3.select('#maxruntime_{{ problem.probid }} svg')
136+
.datum(run_max_times_{{ problem.probid }})
137137
.call(chart);
138138
// Clicking on one of the bars takes you to the judgment
139139
chart.discretebar.dispatch.on('elementClick', function(e) {
@@ -156,24 +156,24 @@ $(function(){
156156
});
157157
158158
// Create our timelimit line
159-
d3.select('#maxruntime_{{problem.probid}} svg')
159+
d3.select('#maxruntime_{{ problem.probid }} svg')
160160
.append('line')
161161
.attr({id: 'maxline'})
162162
.style("stroke", "#F00");
163163
164164
var svgsize = chart.container.clientWidth || chart.container.parentNode.clientWidth;
165-
updateline_{{problem.probid}} = function(){
166-
line = d3.select('#maxruntime_{{problem.probid}} svg #maxline')
165+
updateline_{{ problem.probid }} = function(){
166+
line = d3.select('#maxruntime_{{ problem.probid }} svg #maxline')
167167
.attr({
168168
x1: chart.margin().left,
169-
y1: chart.yAxis.scale()({{problem.timelimit}})+ chart.margin().top,
169+
y1: chart.yAxis.scale()({{ problem.timelimit }})+ chart.margin().top,
170170
x2: +svgsize - chart.margin().right,
171-
y2: chart.yAxis.scale()({{problem.timelimit}}) + chart.margin().top,
171+
y2: chart.yAxis.scale()({{ problem.timelimit }}) + chart.margin().top,
172172
})
173173
}
174-
updateline_{{problem.probid}}();
174+
updateline_{{ problem.probid }}();
175175
nv.utils.windowResize(function() {
176-
updateline_{{problem.probid}}();
176+
updateline_{{ problem.probid }}();
177177
chart.update()
178178
});
179179
return chart;
@@ -189,7 +189,7 @@ $(function(){
189189
values: [
190190
{% for result,count in results %}
191191
{
192-
"label" : "{{result}}",
192+
"label" : "{{ result }}",
193193
"value" : {{ count }},
194194
"color" : "{{ colors[result] }}",
195195
},
@@ -227,8 +227,8 @@ $(function(){
227227
var submission_stats = [
228228
{% for result in ['correct', 'wrong-answer', 'timelimit', 'run-error', 'compiler-error', 'no-output'] %}
229229
{
230-
key: "{{result}}",
231-
color: "{{colors[result]}}",
230+
key: "{{ result }}",
231+
color: "{{ colors[result] }}",
232232
values: [
233233
{# TODO: make sure these are actually ordered by submittime #}
234234
{# TODO: also make sure these submissions are in the same contest #}
@@ -256,7 +256,7 @@ $(function(){
256256
.showYAxis(true) //Show the y-axis
257257
.showXAxis(true) //Show the x-axis
258258
.forceX([0, {{ (current_contest.endtime - current_contest.starttime) / 60 }}])
259-
.forceY([0, {{ submissions|length *1.10 }}])
259+
.forceY([0, {{ submissions | length *1.10 }}])
260260
;
261261
chart.xAxis //Chart x-axis settings
262262
.axisLabel('Contest Time(minutes)')

webapp/templates/jury/auditlog.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{% if maxPages > 1 %}
1515
<ul class="pagination pagination-sm">
1616
<li class="page-item{{ showAll or thisPage == 1 ? ' disabled' }}">
17-
<a class="page-link" href="{{ path('jury_auditlog', {page: thisPage-1 < 1 ? 1 : thisPage-1}) }}">«</a>
17+
<a class="page-link" href="{{ path('jury_auditlog', {page: thisPage - 1 < 1 ? 1 : thisPage - 1}) }}">«</a>
1818
</li>
1919

2020
{% for i in 1..maxPages %}
@@ -24,7 +24,7 @@
2424
{% endfor %}
2525

2626
<li class="page-item{{ showAll or thisPage == maxPages ? ' disabled' }}">
27-
<a class="page-link" href="{{ path('jury_auditlog', {page: thisPage+1 <= maxPages ? thisPage+1 : thisPage}) }}">»</a>
27+
<a class="page-link" href="{{ path('jury_auditlog', {page: thisPage + 1 <= maxPages ? thisPage + 1 : thisPage}) }}">»</a>
2828
</li>
2929

3030
<li class="page-item{{ showAll ? ' active' }}">

webapp/templates/jury/balloons.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
$('select[data-filter-field]').each(function () {
112112
var $filterField = $(this);
113113
if ($filterField.data('filter-field') == "category-id") {
114-
$filterField.val({{- defaultCategories|json_encode() -}}).trigger('change');
114+
$filterField.val({{- defaultCategories | json_encode() -}}).trigger('change');
115115
} else {
116116
$filterField.val([]).trigger('change');
117117
}

0 commit comments

Comments
 (0)