From a9d154506f4a74db0e3106fe97684988a730d7f8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lenglet Date: Fri, 23 Dec 2016 00:35:21 +0100 Subject: [PATCH] Added js validation for max_choice --- .../templates/election/election_detail.jinja | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/election/templates/election/election_detail.jinja b/election/templates/election/election_detail.jinja index 4eb2ad9f..ae02c435 100644 --- a/election/templates/election/election_detail.jinja +++ b/election/templates/election/election_detail.jinja @@ -63,7 +63,7 @@ th { background: lightgrey; } -.role__multiple-choices { +.role__multiple-choices-label { color: darkgreen; } @@ -251,12 +251,12 @@ th { {%- for role in election.role.all() %} {%- set count = [0] %} {%- set role_data = election_form.data.getlist(role.title) if role.title in election_form.data else [] %} - + {{role.title}} {%- if role.max_choice > 1 and not election.has_voted(request.user) %} - {% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %} + {% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %} {%- endif %} {%- if election_form.errors[role.title] is defined %} {%- for error in election_form.errors.as_data()[role.title] %} @@ -330,4 +330,31 @@ th { {%- endif %} +{% endblock %} + +{% block script %} +{{ super() }} + {% endblock %} \ No newline at end of file