Sha256: fbc77e110541a403f81af5ea7cca7bfef7c8801427b7c1818ab2a912aebb2941

Contents?: true

Size: 533 Bytes

Versions: 2

Compression:

Stored size: 533 Bytes

Contents

/* eslint-disable no-invalid-this, no-undefined */

$(document).ready(function () {
  let $remainingVotesCount = $("#remaining-votes-count");
  $('form .multiple_votes_form input[type="checkbox"]').on("change", function(event) {
    let max = parseInt($remainingVotesCount.text(), 10);
    if ($(this).is(":checked")) {
      max -= 1;
    }
    else {
      max += 1;
    }
    if (max < 0) {
      $(this).attr("checked", false);
      event.preventDefault();
    }
    else {
      $remainingVotesCount.text(max);
    }
  });
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-consultations-0.19.1 app/assets/javascripts/decidim/consultations/utils_multiple.js
decidim-consultations-0.19.0 app/assets/javascripts/decidim/consultations/utils_multiple.js