diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2019-08-05 10:20:52 +0300 |
---|---|---|
committer | Markus Koller <mkoller@gitlab.com> | 2019-08-12 23:01:28 +0300 |
commit | 68aab284a11a3c5b261263be9f6ed914d1f46423 (patch) | |
tree | 6999adeeb1657a45b97bff1ae9b4762fe1a47d46 /app/helpers/search_helper.rb | |
parent | 49c83155ccb78284b17a9ffa47583ddace5dbd01 (diff) |
FE fetch counts async on search page load
Creates `refresh_counts` module to dynamically fetch
and load data based on attributes of HAML elements.
Diffstat (limited to 'app/helpers/search_helper.rb')
-rw-r--r-- | app/helpers/search_helper.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index add4e555c70..91c83380b62 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -155,16 +155,15 @@ module SearchHelper li_class = 'active' count = @search_results.formatted_count(scope) else - count = 0 - badge_class = 'js-search-count' - badge_data = { scope: scope, url: search_count_path(search_params) } + badge_class = 'js-search-count hidden' + badge_data = { url: search_count_path(search_params) } end content_tag :li, class: li_class, data: data do link_to search_path(search_params) do concat label concat ' ' - concat content_tag(:span, count, class: 'badge badge-pill', data: { scope: scope }) + concat content_tag(:span, count, class: ['badge badge-pill', badge_class], data: badge_data) end end end |