Add frontend support for long multiple choice widgets

This commit is contained in:
Raphael Michel
2017-10-13 15:57:42 +02:00
parent b9b509ad9b
commit b4928f662a
2 changed files with 31 additions and 0 deletions

View File

@@ -323,4 +323,22 @@ $(function () {
ev.preventDefault();
return true;
})
$(".scrolling-multiple-choice").each(function () {
var $small = $("<small>");
var $a_all = $("<a>").addClass("choice-options-all").attr("href", "#").text(gettext("Alle"));
var $a_none = $("<a>").addClass("choice-options-none").attr("href", "#").text(gettext("Keine"));
$(this).prepend($small.append($a_all).append(" / ").append($a_none));
$(this).find(".choice-options-none").click(function (e) {
$(this).closest(".scrolling-multiple-choice").find("input[type=checkbox]").prop("checked", false);
e.preventDefault();
return false;
});
$(this).find(".choice-options-all").click(function (e) {
$(this).closest(".scrolling-multiple-choice").find("input[type=checkbox]").prop("checked", true);
e.preventDefault();
return false;
});
})
});