From 9287188904a9c78e55ab798e657a3967baf1b039 Mon Sep 17 00:00:00 2001 From: kara Diaby Date: Thu, 13 Feb 2020 15:57:29 +0100 Subject: [PATCH] Fix the thousand separator in order to copy/paste without space --- app/assets/stylesheets/new_design/helpers.scss | 5 +++++ app/helpers/number_helper.rb | 6 ++++++ app/views/shared/dossiers/_champ_row.html.haml | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/helpers/number_helper.rb diff --git a/app/assets/stylesheets/new_design/helpers.scss b/app/assets/stylesheets/new_design/helpers.scss index e6500b579..f8f0f71bf 100644 --- a/app/assets/stylesheets/new_design/helpers.scss +++ b/app/assets/stylesheets/new_design/helpers.scss @@ -11,3 +11,8 @@ .mb-4 { margin-bottom: 4 * $default-spacer; } + +.numbers-delimiter { + display: inline-block; + width: 5px; +} diff --git a/app/helpers/number_helper.rb b/app/helpers/number_helper.rb new file mode 100644 index 000000000..01e169d2f --- /dev/null +++ b/app/helpers/number_helper.rb @@ -0,0 +1,6 @@ +module NumberHelper + def number_with_html_delimiter(num) + # we are using the span delimiter that doesn't insert spaces when copying and pasting the number + number_with_delimiter(num, delimiter: tag.span(class: 'numbers-delimiter')) + end +end diff --git a/app/views/shared/dossiers/_champ_row.html.haml b/app/views/shared/dossiers/_champ_row.html.haml index 25644bb62..18d69d390 100644 --- a/app/views/shared/dossiers/_champ_row.html.haml +++ b/app/views/shared/dossiers/_champ_row.html.haml @@ -35,7 +35,7 @@ - when TypeDeChamp.type_champs.fetch(:datetime) = c.to_s - when TypeDeChamp.type_champs.fetch(:number) - = number_with_delimiter(c.to_s) + = number_with_html_delimiter(c.to_s) - else = format_text_value(c.to_s)