Sha256: 98cfba8a53c0fc8586dd52244d523bf88a65eb20382295a8799db4653bdee538

Contents?: true

Size: 996 Bytes

Versions: 5

Compression:

Stored size: 996 Bytes

Contents

"use strict";

$("[data-checkboxes]").each(function() {
  var me = $(this),
    group = me.data('checkboxes'),
    role = me.data('checkbox-role');

  me.change(function() {
    var all = $('[data-checkboxes="' + group + '"]:not([data-checkbox-role="dad"])'),
      checked = $('[data-checkboxes="' + group + '"]:not([data-checkbox-role="dad"]):checked'),
      dad = $('[data-checkboxes="' + group + '"][data-checkbox-role="dad"]'),
      total = all.length,
      checked_length = checked.length;

    if(role == 'dad') {
      if(me.is(':checked')) {
        all.prop('checked', true);
      }else{
        all.prop('checked', false);
      }
    }else{
      if(checked_length >= total) {
        dad.prop('checked', true);
      }else{
        dad.prop('checked', false);
      }
    }
  });
});

$("#table-1").dataTable({
  "columnDefs": [
    { "sortable": false, "targets": [2,3] }
  ]
});
$("#table-2").dataTable({
  "columnDefs": [
    { "sortable": false, "targets": [0,2,3] }
  ]
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stisla-rails-0.2.0 vendor/assets/javascripts/page/modules-datatables.js
stisla-rails-0.1.5 vendor/assets/javascripts/page/modules-datatables.js
stisla-rails-0.1.4 vendor/assets/javascripts/page/modules-datatables.js
stisla-rails-0.1.3 vendor/assets/javascripts/page/modules-datatables.js
stisla-rails-0.0.2 vendor/assets/javascripts/page/modules-datatables.js