Browse Source

Tidy

pull/2672/head
Rachael Booth 9 months ago
parent
commit
f359ac326a
  1. 8
      app/models/form/page.rb
  2. 16
      app/models/form/question.rb
  3. 1
      app/models/form/sales/pages/buyer_company.rb
  4. 1
      app/models/form/sales/pages/buyer_live.rb
  5. 1
      app/models/form/sales/pages/created_by.rb
  6. 1
      app/models/form/sales/pages/discounted_ownership_type.rb
  7. 1
      app/models/form/sales/pages/joint_purchase.rb
  8. 1
      app/models/form/sales/pages/managing_organisation.rb
  9. 1
      app/models/form/sales/pages/number_joint_buyers.rb
  10. 2
      app/models/form/sales/pages/outright_ownership_type.rb
  11. 1
      app/models/form/sales/pages/ownership_scheme.rb
  12. 1
      app/models/form/sales/pages/owning_organisation.rb
  13. 2
      app/models/form/sales/pages/privacy_notice.rb
  14. 1
      app/models/form/sales/pages/purchaser_code.rb
  15. 1
      app/models/form/sales/pages/sale_date.rb
  16. 1
      app/models/form/sales/pages/shared_ownership_type.rb
  17. 1
      app/models/form/sales/questions/buyer_company.rb
  18. 1
      app/models/form/sales/questions/buyer_live.rb
  19. 1
      app/models/form/sales/questions/created_by_id.rb
  20. 1
      app/models/form/sales/questions/joint_purchase.rb
  21. 1
      app/models/form/sales/questions/managing_organisation.rb
  22. 1
      app/models/form/sales/questions/number_joint_buyers.rb
  23. 3
      app/models/form/sales/questions/other_ownership_type.rb
  24. 3
      app/models/form/sales/questions/outright_ownership_type.rb
  25. 1
      app/models/form/sales/questions/ownership_scheme.rb
  26. 1
      app/models/form/sales/questions/owning_organisation_id.rb
  27. 1
      app/models/form/sales/questions/purchaser_code.rb
  28. 1
      app/models/form/sales/questions/sale_date.rb
  29. 4
      config/locales/forms/2024/sales/setup.en.yml

8
app/models/form/page.rb

@ -24,10 +24,12 @@ class Form::Page
delegate :form, to: :subsection
def header
return @header if @copy_key.nil?
def copy_key
@copy_key ||= "#{form.type}.#{subsection.id}.#{questions[0].id}"
end
I18n.t("forms.#{form.start_date.year}.#{@copy_key}.page_header")
def header
@header ||= I18n.t("forms.#{form.start_date.year}.#{copy_key}.page_header")
end
def routed_to?(log, _current_user)

16
app/models/form/question.rb

@ -48,22 +48,20 @@ class Form::Question
delegate :subsection, to: :page
delegate :form, to: :subsection
def check_answer_label
return @check_answer_label if @copy_key.nil?
def copy_key
@copy_key ||= "#{form.type}.#{subsection.id}.#{id}"
end
I18n.t("forms.#{form.start_date.year}.#{@copy_key}.check_answer_label")
def check_answer_label
@check_answer_label ||= I18n.t("forms.#{form.start_date.year}.#{copy_key}.check_answer_label")
end
def header
return @header if @copy_key.nil?
I18n.t("forms.#{form.start_date.year}.#{@copy_key}.question_text")
@header ||= I18n.t("forms.#{form.start_date.year}.#{copy_key}.question_text")
end
def hint_text
return @hint_text if @copy_key.nil?
I18n.t("forms.#{form.start_date.year}.#{@copy_key}.hint_text")
@hint_text ||= I18n.t("forms.#{form.start_date.year}.#{copy_key}.hint_text")
end
def answer_label(log, user = nil)

1
app/models/form/sales/pages/buyer_company.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::BuyerCompany < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_company"
@copy_key = "sales.setup.companybuy"
@depends_on = [{
"outright_sale?" => true,
}]

1
app/models/form/sales/pages/buyer_live.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::BuyerLive < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_live"
@copy_key = "sales.setup.buylivein"
@depends_on = [{
"companybuy" => 2,
}]

1
app/models/form/sales/pages/created_by.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::CreatedBy < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "assigned_to"
@copy_key = "sales.setup.assigned_to_id"
end
def questions

1
app/models/form/sales/pages/discounted_ownership_type.rb

@ -3,7 +3,6 @@ class Form::Sales::Pages::DiscountedOwnershipType < ::Form::Page
super
@id = "discounted_ownership_type"
@copy_key = "sales.setup.type.discounted_ownership"
@header = header
@depends_on = [{
"ownershipsch" => 2,
}]

1
app/models/form/sales/pages/joint_purchase.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::JointPurchase < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "joint_purchase"
@copy_key = "sales.setup.jointpur"
@depends_on = [
{ "ownershipsch" => 1 },
{ "ownershipsch" => 2 },

1
app/models/form/sales/pages/managing_organisation.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::ManagingOrganisation < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "managing_organisation"
@copy_key = "sales.setup.managing_organisation_id"
end
def questions

1
app/models/form/sales/pages/number_joint_buyers.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::NumberJointBuyers < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "number_joint_buyers"
@copy_key = "sales.setup.jointmore"
@depends_on = [{
"joint_purchase?" => true,
}]

2
app/models/form/sales/pages/outright_ownership_type.rb

@ -2,7 +2,7 @@ class Form::Sales::Pages::OutrightOwnershipType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "outright_ownership_type"
@header = header
@copy_key = "sales.setup.type.outright_ownership"
@depends_on = [{
"ownershipsch" => 3,
}]

1
app/models/form/sales/pages/ownership_scheme.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::OwnershipScheme < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "ownership_scheme"
@copy_key = "sales.setup.ownershipsch"
end
def questions

1
app/models/form/sales/pages/owning_organisation.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::OwningOrganisation < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "owning_organisation"
@copy_key = "sales.setup.owning_organisation_id"
end
def questions

2
app/models/form/sales/pages/privacy_notice.rb

@ -1,7 +1,7 @@
class Form::Sales::Pages::PrivacyNotice < ::Form::Page
def initialize(id, hsh, subsection, joint_purchase:)
super(id, hsh, subsection)
@header = "Ministry of Housing, Communities and Local Government privacy notice"
@copy_key = "sales.setup.privacynotice.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@joint_purchase = joint_purchase
end

1
app/models/form/sales/pages/purchaser_code.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::PurchaserCode < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "purchaser_code"
@copy_key = "sales.setup.purchid"
end
def questions

1
app/models/form/sales/pages/sale_date.rb

@ -2,7 +2,6 @@ class Form::Sales::Pages::SaleDate < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "completion_date"
@copy_key = "sales.setup.saledate"
end
def questions

1
app/models/form/sales/pages/shared_ownership_type.rb

@ -3,7 +3,6 @@ class Form::Sales::Pages::SharedOwnershipType < ::Form::Page
super
@id = "shared_ownership_type"
@copy_key = "sales.setup.type.shared_ownership"
@header = header
@depends_on = [{
"ownershipsch" => 1,
}]

1
app/models/form/sales/questions/buyer_company.rb

@ -2,7 +2,6 @@ class Form::Sales::Questions::BuyerCompany < ::Form::Question
def initialize(id, hsh, page)
super
@id = "companybuy"
@copy_key = "sales.setup.companybuy"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

1
app/models/form/sales/questions/buyer_live.rb

@ -2,7 +2,6 @@ class Form::Sales::Questions::BuyerLive < ::Form::Question
def initialize(id, hsh, page)
super
@id = "buylivein"
@copy_key = "sales.setup.buylivein"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

1
app/models/form/sales/questions/created_by_id.rb

@ -4,7 +4,6 @@ class Form::Sales::Questions::CreatedById < ::Form::Question
def initialize(id, hsh, page)
super
@id = "assigned_to_id"
@copy_key = "sales.setup.assigned_to_id"
@derived = true
@type = "select"
end

1
app/models/form/sales/questions/joint_purchase.rb

@ -2,7 +2,6 @@ class Form::Sales::Questions::JointPurchase < ::Form::Question
def initialize(id, hsh, page)
super
@id = "jointpur"
@copy_key = "sales.setup.jointpur"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

1
app/models/form/sales/questions/managing_organisation.rb

@ -2,7 +2,6 @@ class Form::Sales::Questions::ManagingOrganisation < ::Form::Question
def initialize(id, hsh, page)
super
@id = "managing_organisation_id"
@copy_key = "sales.setup.managing_organisation_id"
@derived = true
@type = "select"
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

1
app/models/form/sales/questions/number_joint_buyers.rb

@ -2,7 +2,6 @@ class Form::Sales::Questions::NumberJointBuyers < ::Form::Question
def initialize(id, hsh, page)
super
@id = "jointmore"
@copy_key = "sales.setup.jointmore"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

3
app/models/form/sales/questions/other_ownership_type.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::OtherOwnershipType < ::Form::Question
def initialize(id, hsh, page)
super
@id = "othtype"
@check_answer_label = "Type of other sale"
@header = "What type of sale is it?"
@copy_key = "sales.setup.type.outright_ownership.othtype"
@type = "text"
@width = 10
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

3
app/models/form/sales/questions/outright_ownership_type.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::OutrightOwnershipType < ::Form::Question
def initialize(id, hsh, page)
super
@id = "type"
@check_answer_label = "Type of outright sale"
@header = "What is the type of outright sale?"
@copy_key = "sales.setup.type.outright_ownership.type"
@type = "radio"
@top_guidance_partial = guidance_partial
@answer_options = ANSWER_OPTIONS

1
app/models/form/sales/questions/ownership_scheme.rb

@ -2,7 +2,6 @@ class Form::Sales::Questions::OwnershipScheme < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ownershipsch"
@copy_key = "sales.setup.ownershipsch"
@type = "radio"
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

1
app/models/form/sales/questions/owning_organisation_id.rb

@ -2,7 +2,6 @@ class Form::Sales::Questions::OwningOrganisationId < ::Form::Question
def initialize(id, hsh, page)
super
@id = "owning_organisation_id"
@copy_key = "sales.setup.owning_organisation_id"
@derived = true
@type = "select"
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

1
app/models/form/sales/questions/purchaser_code.rb

@ -2,7 +2,6 @@ class Form::Sales::Questions::PurchaserCode < ::Form::Question
def initialize(id, hsh, page)
super
@id = "purchid"
@copy_key = "sales.setup.purchid"
@type = "text"
@width = 10
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

1
app/models/form/sales/questions/sale_date.rb

@ -2,7 +2,6 @@ class Form::Sales::Questions::SaleDate < ::Form::Question
def initialize(id, hsh, page)
super
@id = "saledate"
@copy_key = "sales.setup.saledate"
@type = "date"
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
config/locales/forms/2024/sales/setup.en.yml

@ -99,12 +99,12 @@ en:
privacynotice:
joint_purchase:
page_header: ""
page_header: "Ministry of Housing, Communities and Local Government privacy notice"
check_answer_label: "Buyers have seen the privacy notice?"
hint_text: ""
question_text: "Declaration"
not_joint_purchase:
page_header: ""
page_header: "Ministry of Housing, Communities and Local Government privacy notice"
check_answer_label: "Buyer has seen the privacy notice?"
hint_text: ""
question_text: "Declaration"

Loading…
Cancel
Save