Skip to content
Snippets Groups Projects
Commit d2da6a71 authored by Martin Mareš's avatar Martin Mareš
Browse files

JavaScript k tabulce řešení osamostatněn

parent 6f047a54
No related branches found
No related tags found
1 merge request!134Prázdné protokoly
{# Společný JavaScript a checkbox povolující zakládání pro tabulky řešení #}
{% if edit %}
<script type="text/javascript">
window.addEventListener("load", function() {
for (const ch of document.querySelectorAll("input[type=checkbox]")) {
ch.onchange();
}
for (const i of document.querySelectorAll("input[type=text]")) {
i.oninput();
}
});
function update_disabled_fields(allow_create) {
for (const i of document.querySelectorAll("input[type=text]")) {
if (i.dataset.sol == "0") {
i.disabled = !allow_create;
}
}
}
</script>
{% endif %}
{% if edit_create %}
<div class="form-group"><div class="checkbox">
<label>
<input
type="checkbox"
name="create_sols"
onchange="update_disabled_fields(this.checked)"
value="y"
{% if not edit_create %}
disabled
{% elif not ctx.contest.online_submit %}
checked
{% endif %}
>
Zakládat nová řešení
</label>
</div></div>
{% endif %}
......@@ -148,43 +148,4 @@ finální (ve výchozím stavu poslední nahrané).{% elif rights.can_upload_sol
{% endfor %}
</table>
{% if edit %}
<script type="text/javascript">
window.addEventListener("load", function() {
for (const ch of document.querySelectorAll("input[type=checkbox]")) {
ch.onchange();
}
for (const i of document.querySelectorAll("input[type=text]")) {
i.oninput();
}
});
function update_disabled_fields(allow_create) {
for (const i of document.querySelectorAll("input[type=text]")) {
if (i.dataset.sol == "0") {
i.disabled = !allow_create;
}
}
}
</script>
{% endif %}
{% if edit_create %}
<div class="form-group"><div class="checkbox">
<label>
<input
type="checkbox"
name="create_sols"
onchange="update_disabled_fields(this.checked)"
tabindex={{ tabindex.value }} autofocus
value="y"
{% if not edit_create %}
disabled
{% elif not contest_online_submit %}
checked
{% endif %}
>
Zakládat nová řešení
</label>
</div></div>
{% endif %}
{% include "parts/org_solution_js.html" %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment