Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sidebars/concerns/has_pill.rb')
-rw-r--r--lib/sidebars/concerns/has_pill.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/sidebars/concerns/has_pill.rb b/lib/sidebars/concerns/has_pill.rb
index 5082ed477e6..4bbf69bf16b 100644
--- a/lib/sidebars/concerns/has_pill.rb
+++ b/lib/sidebars/concerns/has_pill.rb
@@ -5,6 +5,8 @@
module Sidebars
module Concerns
module HasPill
+ include ActionView::Helpers::NumberHelper
+
def has_pill?
false
end
@@ -18,6 +20,17 @@ module Sidebars
def pill_html_options
{}
end
+
+ def format_cached_count(count_service, count)
+ if count > count_service::CACHED_COUNT_THRESHOLD
+ number_to_human(
+ count,
+ units: { thousand: 'k', million: 'm' }, precision: 1, significant: false, format: '%n%u'
+ )
+ else
+ number_with_delimiter(count)
+ end
+ end
end
end
end