Commit b26b6108 authored by Harumi Jang's avatar Harumi Jang 🤠 Committed by Tim Plunkett
Browse files

Issue #3282589 by hooroomoo, srishtiiee: No way to return to Default filters

parent 3ffee584
Loading
Loading
Loading
Loading
+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+33 −4
Original line number Diff line number Diff line
@@ -21,7 +21,13 @@
    moduleCategoryFilter,
    moduleCategoryVocabularies,
  } from './stores';
  import { SORT_OPTIONS, COVERED, ACTIVELY_MAINTAINED } from './constants';
  import {
    SORT_OPTIONS,
    COVERED,
    ACTIVELY_MAINTAINED,
    COVERED_ID,
    ACTIVELY_MAINTAINED_ID,
  } from './constants';

  const { Drupal } = window;
  const dispatch = createEventDispatcher();
@@ -320,8 +326,7 @@
      {/each}

      {#if $filters.securityCoverage.length || $filters.maintenanceStatus.length || $filters.developmentStatus.length || $moduleCategoryFilter.length}
        <a
          href={'#'}
        <button
          on:click={() => {
            $filters.maintenanceStatus = [];
            $filters.developmentStatus = [];
@@ -333,7 +338,22 @@
          }}
        >
          {Drupal.t('Clear filters')}
        </a>
        </button>
      {/if}
      {#if !($filters.maintenanceStatus.length === 1 && $filters.maintenanceStatus[0] === ACTIVELY_MAINTAINED_ID && $filters.securityCoverage.length === 1 && $filters.securityCoverage[0] === COVERED_ID && $filters.developmentStatus.length === 0 && $moduleCategoryFilter.length === 0)}
        <button
          on:click={() => {
            $filters.maintenanceStatus = [ACTIVELY_MAINTAINED_ID];
            $filters.securityCoverage = [COVERED_ID];
            $filters.developmentStatus = [];
            $moduleCategoryFilter = [];
            $filters = $filters;
            onAdvancedFilter();
            onSelectCategory();
          }}
        >
          {Drupal.t('Recommended filters')}
        </button>
      {/if}
    </div>

@@ -540,4 +560,13 @@
  .selected {
    background-color: #f3f4f9;
  }

  button {
    padding: 0 0.25rem;
    background: none;
    border: none;
    color: #013cc5;
    text-decoration: underline;
    cursor: pointer;
  }
</style>
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@ export const ACTIVELY_MAINTAINED =
  drupalSettings.project_browser.special_ids.maintenance_status.name;
export const COVERED =
  drupalSettings.project_browser.special_ids.security_coverage.name;
export const ACTIVELY_MAINTAINED_ID =
  drupalSettings.project_browser.special_ids.maintenance_status.id;
export const COVERED_ID =
  drupalSettings.project_browser.special_ids.security_coverage.id;

/*
 * SORT OPTIONS
Loading