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

numbers_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7184a9c075c7c913148cd6d0a5ec9002bce8daba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

module NumbersHelper
  def limited_counter_with_delimiter(resource, **options)
    limit = options.fetch(:limit, 1000).to_i
    count = resource.page.total_count_with_limit(:all, limit: limit)

    if count > limit
      "#{number_with_delimiter(count - 1, options)}+"
    else
      number_with_delimiter(count, options)
    end
  end
end