From 1178cc727303451b2b48ae7f79f5c0c3f14eb49a Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 30 Jan 2025 16:21:30 +0100 Subject: [PATCH] Drop word_pluralize helper It makes no sense... --- app/helpers/format_helper.rb | 10 ---------- app/views/conference_registrations/show.html.haml | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/app/helpers/format_helper.rb b/app/helpers/format_helper.rb index 152ac239..1ccc30c6 100644 --- a/app/helpers/format_helper.rb +++ b/app/helpers/format_helper.rb @@ -114,16 +114,6 @@ module FormatHelper end end - def word_pluralize(count, singular, plural = nil) - word = if (count == 1 || count =~ /^1(\.0+)?$/) - singular - else - plural || singular.pluralize - end - - word - end - # Returns black or white deppending on what of them contrast more with the # given color. Useful to print text in a coloured background. # hexcolor is a hex color of 7 characters, being the first one '#'. diff --git a/app/views/conference_registrations/show.html.haml b/app/views/conference_registrations/show.html.haml index d9447049..b6ba793b 100644 --- a/app/views/conference_registrations/show.html.haml +++ b/app/views/conference_registrations/show.html.haml @@ -94,7 +94,7 @@ %li = @total_quantity[ticket_id] = tickets.first.title - = word_pluralize(@total_quantity[ticket_id], 'Ticket') + = pluralize(@total_quantity[ticket_id], 'Ticket') for = tickets.first.price.symbol = humanized_money @total_price_per_ticket[ticket_id] @@ -148,7 +148,7 @@ %i.fa-solid.fa-user-group.fa-stack-1x = @conference.participants.count Registered - = word_pluralize(@conference.participants.count, 'Attendee') + = pluralize(@conference.participants.count, 'Attendee') - @conference.participants.each do |participant| = link_to image_tag(participant.gravatar_url(size: '25'), title: "#{participant.name}!", class: 'img-circle'), user_path(participant) .col-md-4.col-md-offset-2 @@ -159,6 +159,6 @@ %i.fa-solid.fa-microphone.fa-stack-1x = @conference.program.speakers.confirmed.count Confirmed - = word_pluralize(@conference.program.speakers.confirmed.count, 'Speaker') + = pluralize(@conference.program.speakers.confirmed.count, 'Speaker') - @conference.program.speakers.confirmed.each do |speaker| = link_to image_tag(speaker.gravatar_url(size: '25'), title: "#{speaker.name}!", class: 'img-circle'), user_path(speaker)