diff options
| author | Zog | 2018-02-02 12:43:55 +0100 | 
|---|---|---|
| committer | Zog | 2018-02-02 12:43:55 +0100 | 
| commit | 771084101913ec0fb6d5790786ae533b5413f9b2 (patch) | |
| tree | 02f57ee2661e2358e49067459dd9870bb7de18ce /app/helpers | |
| parent | 6300165062bacc73bf900723c1dbed1d69425c95 (diff) | |
| download | chouette-core-771084101913ec0fb6d5790786ae533b5413f9b2.tar.bz2 | |
Refs #5832 @1h; Show active filters5832-fix-filter-by-stopareas-on-vjs-index
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/search_helper.rb | 15 | 
1 files changed, 15 insertions, 0 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index f4976ea53..be70d974d 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -8,4 +8,19 @@ module SearchHelper      link_to name, params.deep_merge("q" => search,:page => 1), html_options    end +  def filter_item_class q, key +    active = false +    if q.present? && q[key].present? +      val = q[key] +      if val.is_a?(Array) +        active = val.any? &:present? +      elsif val.is_a?(Hash) +        active = val.values.any? &:present? +      else +        active = true +      end +    end +    active ? 'active' : 'inactive' +  end +  end  | 
