2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
module NumbersHelper
|
|
|
|
def limited_counter_with_delimiter(resource, **options)
|
|
|
|
limit = options.fetch(:limit, 1000).to_i
|
2020-06-23 00:09:42 +05:30
|
|
|
count = resource.page.total_count_with_limit(:all, limit: limit)
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
if count > limit
|
2023-03-04 22:38:38 +05:30
|
|
|
"#{number_with_delimiter(count - 1, options)}+"
|
2018-03-17 18:26:18 +05:30
|
|
|
else
|
|
|
|
number_with_delimiter(count, options)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|