Unverified Commit 21e024ea authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3024975 by quiron, huzooka, lauriii, Wim Leers, nod_: Add Drupal...

Issue #3024975 by quiron, huzooka, lauriii, Wim Leers, nod_: Add Drupal JavaScript theme function for checkbox
parent 6340ef58
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -127,6 +127,13 @@ drupal.batch:
    - core/drupal.progress
    - core/jquery.once

drupal.checkbox:
  version: VERSION
  js:
    misc/checkbox.js: {}
  dependencies:
    - core/drupal

drupal.collapse:
  version: VERSION
  js:
@@ -307,6 +314,7 @@ drupal.tableselect:
    misc/tableselect.js: {}
  dependencies:
    - core/drupal
    - core/drupal.checkbox
    - core/jquery
    - core/jquery.once

+15 −0
Original line number Diff line number Diff line
/**
 * @file
 * Defines checkbox theme functions.
 */

(Drupal => {
  /**
   * Theme function for a checkbox.
   *
   * @return {string}
   *   The HTML markup for the checkbox.
   */
  Drupal.theme.checkbox = () =>
    `<input type="checkbox" class="form-checkbox"/>`;
})(Drupal);

core/misc/checkbox.js

0 → 100644
+12 −0
Original line number Diff line number Diff line
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/

(function (Drupal) {
  Drupal.theme.checkbox = function () {
    return "<input type=\"checkbox\" class=\"form-checkbox\"/>";
  };
})(Drupal);
 No newline at end of file
+1 −6
Original line number Diff line number Diff line
@@ -70,12 +70,7 @@
    // Find all <th> with class select-all, and insert the check all checkbox.
    $table
      .find('th.select-all')
      .prepend(
        $('<input type="checkbox" class="form-checkbox" />').attr(
          'title',
          strings.selectAll,
        ),
      )
      .prepend($(Drupal.theme('checkbox')).attr('title', strings.selectAll))
      .on('click', event => {
        if ($(event.target).is('input[type="checkbox"]')) {
          // Loop through all checkboxes and set their state to the select all
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@
      });
    };

    $table.find('th.select-all').prepend($('<input type="checkbox" class="form-checkbox" />').attr('title', strings.selectAll)).on('click', function (event) {
    $table.find('th.select-all').prepend($(Drupal.theme('checkbox')).attr('title', strings.selectAll)).on('click', function (event) {
      if ($(event.target).is('input[type="checkbox"]')) {
        checkboxes.each(function () {
          var $checkbox = $(this);
Loading