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-2.8.1 app/javascript/active_admin/lib/table-checkbox-toggler.js
activeadmin-2.8.0 app/javascript/active_admin/lib/table-checkbox-toggler.js