diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-07-08 19:53:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 19:53:43 +0200 |
commit | f040b9aee3f84cb3ba8926fed81d47df3f1094a7 (patch) | |
tree | b0060a43c4bf69e441e33de77a49006fa2ac033c /app/helpers/application_helper.rb | |
parent | 0c2eb949fc21ceecbd99a81e5ffe75517a1e64df (diff) | |
parent | 101f8616feb845f70ef89fa0d0b3ebc37c472930 (diff) |
Merge pull request #1562 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5a9496bd4..cc622478d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -14,6 +14,17 @@ module ApplicationHelper ku ).freeze + def friendly_number_to_human(number, **options) + # By default, the number of precision digits used by number_to_human + # is looked up from the locales definition, and rails-i18n comes with + # values that don't seem to make much sense for many languages, so + # override these values with a default of 3 digits of precision. + options[:precision] = 3 + options[:strip_insignificant_zeros] = true + + number_to_human(number, **options) + end + def active_nav_class(*paths) paths.any? { |path| current_page?(path) } ? 'active' : '' end |