Sha256: 1e12316d38aa809473fe8d6a60052dfbfb8e33b9b8e2e3d39067ac68b442eaed

Contents?: true

Size: 808 Bytes

Versions: 22

Compression:

Stored size: 808 Bytes

Contents

import CheckboxToggler from "./checkbox-toggler";

class TableCheckboxToggler extends CheckboxToggler {
  _bind() {
    super._bind(...arguments);

    this.$container
      .find('tbody td')
      .click(event => {
        if (event.target.type !== 'checkbox') {
          this._didClickCell(event.target);
        }
      });
  }

  _didChangeCheckbox(checkbox) {
    super._didChangeCheckbox(...arguments);

    $(checkbox)
      .parents('tr')
      .toggleClass('selected', checkbox.checked);
  }

  _didChangeToggleAllCheckbox() {
    this.$container
      .find('tbody tr')
      .toggleClass('selected', super._didChangeToggleAllCheckbox(...arguments));
  }

  _didClickCell(cell) {
    $(cell)
      .parent('tr')
      .find(':checkbox')
      .click();
  }
}

export default TableCheckboxToggler;

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
activeadmin-3.2.5 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-3.2.4 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-3.2.3 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-3.2.2 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-3.2.1 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-3.2.0 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-3.1.0 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-3.0.0 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.14.0 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.13.1 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.13.0 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.12.0 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.11.2 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.11.1 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.11.0 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.10.1 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.10.0 app/javascript/active_admin/lib/table-checkbox-toggler.js
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/app/javascript/active_admin/lib/table-checkbox-toggler.js
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.9.0 app/javascript/active_admin/lib/table-checkbox-toggler.js