diff --git a/app/helpers/stats_helper.rb b/app/helpers/stats_helper.rb index 5fd42027e..eef463a99 100644 --- a/app/helpers/stats_helper.rb +++ b/app/helpers/stats_helper.rb @@ -34,4 +34,10 @@ module StatsHelper def number_to_stats_percentage(number, options = {}) number_to_percentage(number, { strip_insignificant_zeros: true, precision: 2 }.merge(options)) end + + def number_with_info_tags(number, text, html_class: "") + content_tag :p, class: "number-with-info #{html_class}".strip do + content_tag(:span, number, class: "number") + content_tag(:span, text, class: "info") + end + end end diff --git a/app/views/shared/stats/_participation.html.erb b/app/views/shared/stats/_participation.html.erb index d49fb839b..a806e2d0a 100644 --- a/app/views/shared/stats/_participation.html.erb +++ b/app/views/shared/stats/_participation.html.erb @@ -4,30 +4,27 @@
- <%= stats[:total_participants] %> - <%= t("polls.show.stats.total_votes") %> -
+ <%= number_with_info_tags( + stats[:total_participants], + t("polls.show.stats.total_votes"), + html_class: "participants total-participants" + ) %>- <%= stats[:total_male_participants] %> - - <%= I18n.t("stats.men_percentage", - percentage: number_to_stats_percentage(stats[:male_percentage])) %> - -
+ <%= number_with_info_tags( + stats[:total_male_participants], + t("stats.men_percentage", percentage: number_to_stats_percentage(stats[:male_percentage])), + html_class: "participants male" + ) %> -- <%= stats[:total_female_participants] %> - - <%= I18n.t("stats.women_percentage", - percentage: number_to_stats_percentage(stats[:female_percentage])) %> - -
+ <%= number_with_info_tags( + stats[:total_female_participants], + t("stats.women_percentage", percentage: number_to_stats_percentage(stats[:female_percentage])), + html_class: "participants female" + ) %>