Browse Source

use built in rails methods of pluralising copy

pull/1326/head
Arthur Campbell 3 years ago
parent
commit
3fca5f7338
  1. 5
      app/helpers/copy_helper.rb
  2. 8
      app/models/form/sales/questions/buyer_previous.rb
  3. 4
      app/models/form/sales/questions/prevown.rb
  4. 4
      app/models/form/sales/questions/staircase_owned.rb
  5. 12
      config/locales/en.yml

5
app/helpers/copy_helper.rb

@ -1,5 +0,0 @@
module CopyHelper
def translate(key, pluralise_condition: false)
I18n.t(key, count: pluralise_condition ? 2 : 1)
end
end

8
app/models/form/sales/questions/buyer_previous.rb

@ -1,13 +1,9 @@
class Form::Sales::Questions::BuyerPrevious < ::Form::Question
include CopyHelper
def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page)
@id = "soctenant"
@check_answer_label = translate("check_answer_labels.soctenant", pluralise_condition: joint_purchase)
# @check_answer_label = I18n.t("check_answer_labels.soctenant", count: joint_purchase ? 2 : 1)
@header = translate("questions.soctenant", pluralise_condition: joint_purchase)
# @header = I18n.t("questions.soctenant", count: joint_purchase ? 2 : 1)
@check_answer_label = I18n.t("check_answer_labels.soctenant", count: joint_purchase ? 2 : 1)
@header = I18n.t("questions.soctenant", count: joint_purchase ? 2 : 1)
@type = "radio"
@answer_options = ANSWER_OPTIONS
end

4
app/models/form/sales/questions/prevown.rb

@ -2,8 +2,8 @@ class Form::Sales::Questions::Prevown < ::Form::Question
def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page)
@id = "prevown"
@check_answer_label = "Buyer#{'s' if joint_purchase} previously owned a property"
@header = "#{joint_purchase ? 'Have any of the buyers' : 'Has the buyer'} previously owned a property?"
@check_answer_label = I18n.t("check_answer_labels.prevown", count: joint_purchase ? 2 : 1)
@header = I18n.t("questions.prevown", count: joint_purchase ? 2 : 1)
@type = "radio"
@answer_options = ANSWER_OPTIONS
end

4
app/models/form/sales/questions/staircase_owned.rb

@ -2,8 +2,8 @@ class Form::Sales::Questions::StaircaseOwned < ::Form::Question
def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page)
@id = "stairowned"
@check_answer_label = "Percentage the buyer#{'s' if joint_purchase} now own#{'s' unless joint_purchase} in total"
@header = "What percentage of the property #{joint_purchase ? 'do the buyers' : 'does the buyer'} now own in total?"
@check_answer_label = I18n.t("check_answer_labels.stairowned", count: joint_purchase ? 2 : 1)
@header = I18n.t("questions.stairowned", count: joint_purchase ? 2 : 1)
@type = "numeric"
@width = 5
@min = 0

12
config/locales/en.yml

@ -541,6 +541,12 @@ en:
soctenant:
one: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?"
other: "Were any of the buyers private registered providers, housing association or local authority tenants immediately before this sale?"
prevown:
one: "Has the buyer previously owned a property?"
other: "Have any of the buyers previously owned a property?"
stairowned:
one: "What percentage of the property does the buyer now own in total?"
other: "What percentage of the property do the buyers now own in total?"
hints:
location:
@ -558,6 +564,12 @@ en:
soctenant:
one: "Buyer was a registered provider, housing association or local authority tenant immediately before this sale?"
other: "Any buyers were registered providers, housing association or local authority tenants immediately before this sale?"
prevown:
one: "Buyer previously owned a property"
other: "Buyers previously owned a property"
stairowned:
one: "Percentage the buyer now owns in total"
other: "Percentage the buyers now own in total"
warnings:
location:

Loading…
Cancel
Save