diff options
| author | Zog | 2018-02-02 12:43:55 +0100 |
|---|---|---|
| committer | cedricnjanga | 2018-02-06 11:11:32 -0800 |
| commit | 401754ecbe63e65736697c14123c6a21b2d34157 (patch) | |
| tree | 8eab384e1efc4db1aa7204fb5fdf01d25e582984 /app/helpers | |
| parent | 0d620e6ad68ac1e1bcc393f3b87c4bf4259b2531 (diff) | |
| download | chouette-core-401754ecbe63e65736697c14123c6a21b2d34157.tar.bz2 | |
Refs #5832 @1h; Show active filters
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 |
