Sha256: 6a9c2e0a552e4145f9a9c8b1eed8c349061925317f8a7e12f3313f3f1381a213
Contents?: true
Size: 871 Bytes
Versions: 16
Compression:
Stored size: 871 Bytes
Contents
$(document).ready(function() { $checkboxes = $('[data-boarded-bus]'); function updateCount() { var count = $checkboxes.filter(':checked').length $('#boarded-bus-count').text(count + ' boarded') } if ($checkboxes.length < 1) { return; } $checkboxes.on('change', function() { $checkbox = $(this); var checked = $checkbox.is(':checked'); $.ajax({ url: $checkbox.data('action'), type: 'PATCH', data: { questionnaire: { boarded_bus: checked, id: $checkbox.data('id'), } } }).done(function() { $checkbox.prop('checked', checked); }).fail(function() { alert("Request failed, please refresh the page or try again later."); }).always(function() { $('[type=submit][data-bulk-row-edit]').prop('disabled', false); updateCount() }); }); });
Version data entries
16 entries across 16 versions & 1 rubygems