Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / filter / filter.admin.es6.js
index 7c69fe07c45854df24029cbdb21dc3d8617fba09..fe2cca742c6773ee35dbe9cbfd569e7e3786576d 100644 (file)
@@ -3,7 +3,7 @@
  * Attaches administration-specific behavior for the Filter module.
  */
 
-(function ($, Drupal) {
+(function($, Drupal) {
   /**
    * Displays and updates the status of filters on the admin page.
    *
   Drupal.behaviors.filterStatus = {
     attach(context, settings) {
       const $context = $(context);
-      $context.find('#filters-status-wrapper input.form-checkbox').once('filter-status').each(function () {
-        const $checkbox = $(this);
-        // Retrieve the tabledrag row belonging to this filter.
-        const $row = $context.find(`#${$checkbox.attr('id').replace(/-status$/, '-weight')}`).closest('tr');
-        // Retrieve the vertical tab belonging to this filter.
-        const $filterSettings = $context.find(`#${$checkbox.attr('id').replace(/-status$/, '-settings')}`);
-        const filterSettingsTab = $filterSettings.data('verticalTab');
+      $context
+        .find('#filters-status-wrapper input.form-checkbox')
+        .once('filter-status')
+        .each(function() {
+          const $checkbox = $(this);
+          // Retrieve the tabledrag row belonging to this filter.
+          const $row = $context
+            .find(`#${$checkbox.attr('id').replace(/-status$/, '-weight')}`)
+            .closest('tr');
+          // Retrieve the vertical tab belonging to this filter.
+          const $filterSettings = $context.find(
+            `#${$checkbox.attr('id').replace(/-status$/, '-settings')}`,
+          );
+          const filterSettingsTab = $filterSettings.data('verticalTab');
 
-        // Bind click handler to this checkbox to conditionally show and hide
-        // the filter's tableDrag row and vertical tab pane.
-        $checkbox.on('click.filterUpdate', () => {
-          if ($checkbox.is(':checked')) {
-            $row.show();
-            if (filterSettingsTab) {
-              filterSettingsTab.tabShow().updateSummary();
+          // Bind click handler to this checkbox to conditionally show and hide
+          // the filter's tableDrag row and vertical tab pane.
+          $checkbox.on('click.filterUpdate', () => {
+            if ($checkbox.is(':checked')) {
+              $row.show();
+              if (filterSettingsTab) {
+                filterSettingsTab.tabShow().updateSummary();
+              } else {
+                // On very narrow viewports, Vertical Tabs are disabled.
+                $filterSettings.show();
+              }
+            } else {
+              $row.hide();
+              if (filterSettingsTab) {
+                filterSettingsTab.tabHide().updateSummary();
+              } else {
+                // On very narrow viewports, Vertical Tabs are disabled.
+                $filterSettings.hide();
+              }
             }
-            else {
-              // On very narrow viewports, Vertical Tabs are disabled.
-              $filterSettings.show();
-            }
-          }
-          else {
-            $row.hide();
-            if (filterSettingsTab) {
-              filterSettingsTab.tabHide().updateSummary();
-            }
-            else {
-              // On very narrow viewports, Vertical Tabs are disabled.
-              $filterSettings.hide();
-            }
-          }
-          // Restripe table after toggling visibility of table row.
-          Drupal.tableDrag['filter-order'].restripeTable();
-        });
+            // Restripe table after toggling visibility of table row.
+            Drupal.tableDrag['filter-order'].restripeTable();
+          });
 
-        // Attach summary for configurable filters (only for screen readers).
-        if (filterSettingsTab) {
-          filterSettingsTab.details.drupalSetSummary(() => ($checkbox.is(':checked') ? Drupal.t('Enabled') : Drupal.t('Disabled')));
-        }
+          // Attach summary for configurable filters (only for screen readers).
+          if (filterSettingsTab) {
+            filterSettingsTab.details.drupalSetSummary(
+              () =>
+                $checkbox.is(':checked')
+                  ? Drupal.t('Enabled')
+                  : Drupal.t('Disabled'),
+            );
+          }
 
-        // Trigger our bound click handler to update elements to initial state.
-        $checkbox.triggerHandler('click.filterUpdate');
-      });
+          // Trigger our bound click handler to update elements to initial state.
+          $checkbox.triggerHandler('click.filterUpdate');
+        });
     },
   };
-}(jQuery, Drupal));
+})(jQuery, Drupal);