Module: Sidebars::Concerns::HasPill
- Includes:
- ActionView::Helpers::NumberHelper
- Included in:
- IssuablesHelper, Menu
- Defined in:
- lib/sidebars/concerns/has_pill.rb
Instance Method Summary collapse
- #format_cached_count(threshold, count) ⇒ Object
- #has_pill? ⇒ Boolean
-
#pill_count ⇒ Object
In this method we will need to provide the query to retrieve the elements count.
- #pill_html_options ⇒ Object
Instance Method Details
#format_cached_count(threshold, count) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sidebars/concerns/has_pill.rb', line 24 def format_cached_count(threshold, count) if 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 |
#has_pill? ⇒ Boolean
10 11 12 |
# File 'lib/sidebars/concerns/has_pill.rb', line 10 def has_pill? false end |
#pill_count ⇒ Object
In this method we will need to provide the query to retrieve the elements count
16 17 18 |
# File 'lib/sidebars/concerns/has_pill.rb', line 16 def pill_count raise NotImplementedError end |
#pill_html_options ⇒ Object
20 21 22 |
# File 'lib/sidebars/concerns/has_pill.rb', line 20 def {} end |