Uploaded image for project: 'COmanage'
  1. COmanage
  2. CO-2168

Only show "CLEAR FILTERS" link on the filters bar when there are filters to clear

    XMLWordPrintable

Details

    • COmanage UI 3 Marathon

    Description

      The "CLEAR FILTERS" link will appear on the filter bar when a sort has been requested but no active filters are in place.

      In app/View/Elements/search.ctp we have:

      <?php if(!empty($search_params)):?>
      

      but $search_params contains the sort information as well as the search fields. So, when there are no search fields to display, but a sort exists, this will not be empty. Therefore we need a further test around the "CLEAR FILTERS" link.

      We can add a “hasFilters” variable that is false, and set it to true after we’ve bypassed the continue statement (approx. lines 69-71):

      if(!in_array($key, $search_fields)) {
        continue;
      }
      

      Then we can just wrap the #top-search-clear-all-button block with a conditional to only show if hasFilters is true.

      Attachments

        Activity

          People

            arlen.johnson@at.internet2.edu Arlen Johnson (google.com)
            arlen.johnson@at.internet2.edu Arlen Johnson (google.com)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: