Disable fields in bulk change on checkbox

This commit is contained in:
rubenwardy 2019-01-28 23:40:31 +00:00
parent f822027ec5
commit f112756b04
1 changed files with 21 additions and 0 deletions

View File

@ -41,4 +41,25 @@
{% block scriptextra %}
<script src="/static/release_minmax.js?v=1"></script>
<script>
function setup_toggle(type) {
var toggle = $("#set_" + type);
function on_change() {
if (toggle.is(":checked")) {
$("#" + type + "_rel").removeAttr("disabled");
$("#" + type + "_rel").parent().css("opacity", "1");
} else {
$("#" + type + "_rel").attr("disabled", "disabled");
$("#" + type + "_rel").parent().css("opacity", "0.4");
$("#" + type + "_rel").val($("#" + type + "_rel option:first-child").attr("value"));
$("#" + type + "_rel").change();
}
}
toggle.change(on_change);
on_change();
}
setup_toggle("min");
setup_toggle("max");
</script>
{% endblock %}