Browse Source

CLDC-2075: guidance partial displaying depends on specific year

pull/1707/head
Aaron Spencer 3 years ago
parent
commit
26f8af86d6
  1. 6
      app/models/form/sales/pages/discounted_ownership_type.rb
  2. 6
      app/models/form/sales/pages/outright_ownership_type.rb
  3. 6
      app/models/form/sales/pages/shared_ownership_type.rb
  4. 6
      app/models/form/sales/questions/discounted_ownership_type.rb
  5. 6
      app/models/form/sales/questions/outright_ownership_type.rb
  6. 6
      app/models/form/sales/questions/shared_ownership_type.rb

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

@ -2,7 +2,7 @@ class Form::Sales::Pages::DiscountedOwnershipType < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "discounted_ownership_type" @id = "discounted_ownership_type"
@header = "Discounted ownership type" @header = header
@depends_on = [{ @depends_on = [{
"ownershipsch" => 2, "ownershipsch" => 2,
}] }]
@ -13,4 +13,8 @@ class Form::Sales::Pages::DiscountedOwnershipType < ::Form::Page
Form::Sales::Questions::DiscountedOwnershipType.new(nil, nil, self), Form::Sales::Questions::DiscountedOwnershipType.new(nil, nil, self),
] ]
end end
def header
"Discounted ownership type" if form.start_date.year >= 2023
end
end end

6
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) def initialize(id, hsh, subsection)
super super
@id = "outright_ownership_type" @id = "outright_ownership_type"
@header = "Outright ownership type" @header = header
@depends_on = [{ @depends_on = [{
"ownershipsch" => 3, "ownershipsch" => 3,
}] }]
@ -14,4 +14,8 @@ class Form::Sales::Pages::OutrightOwnershipType < ::Form::Page
Form::Sales::Questions::OtherOwnershipType.new(nil, nil, self), Form::Sales::Questions::OtherOwnershipType.new(nil, nil, self),
] ]
end end
def header
"Outright ownership type" if form.start_date.year >= 2023
end
end end

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

@ -2,12 +2,16 @@ class Form::Sales::Pages::SharedOwnershipType < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "shared_ownership_type" @id = "shared_ownership_type"
@header = "Shared Ownership" @header = header
@depends_on = [{ @depends_on = [{
"ownershipsch" => 1, "ownershipsch" => 1,
}] }]
end end
def header
"Shared ownership type" if form.start_date.year >= 2023
end
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::SharedOwnershipType.new(nil, nil, self), Form::Sales::Questions::SharedOwnershipType.new(nil, nil, self),

6
app/models/form/sales/questions/discounted_ownership_type.rb

@ -5,7 +5,7 @@ class Form::Sales::Questions::DiscountedOwnershipType < ::Form::Question
@check_answer_label = "Type of discounted ownership sale" @check_answer_label = "Type of discounted ownership sale"
@header = "What is the type of discounted ownership sale?" @header = "What is the type of discounted ownership sale?"
@type = "radio" @type = "radio"
@guidance_partial = "discounted_ownership_type_definitions" @guidance_partial = guidance_partial
@guidance_position = GuidancePosition::TOP @guidance_position = GuidancePosition::TOP
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 5 @question_number = 5
@ -20,4 +20,8 @@ class Form::Sales::Questions::DiscountedOwnershipType < ::Form::Question
"21" => { "value" => "Social HomeBuy for outright purchase" }, "21" => { "value" => "Social HomeBuy for outright purchase" },
"22" => { "value" => "Any other equity loan scheme" }, "22" => { "value" => "Any other equity loan scheme" },
}.freeze }.freeze
def guidance_partial
"discounted_ownership_type_definitions" if form.start_date.year >= 2023
end
end end

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

@ -5,7 +5,7 @@ class Form::Sales::Questions::OutrightOwnershipType < ::Form::Question
@check_answer_label = "Type of outright sale" @check_answer_label = "Type of outright sale"
@header = "What is the type of outright sale?" @header = "What is the type of outright sale?"
@type = "radio" @type = "radio"
@guidance_partial = "outright_sale_type_definitions" @guidance_partial = guidance_partial
@guidance_position = GuidancePosition::TOP @guidance_position = GuidancePosition::TOP
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@conditional_for = { @conditional_for = {
@ -18,4 +18,8 @@ class Form::Sales::Questions::OutrightOwnershipType < ::Form::Question
"10" => { "value" => "Outright" }, "10" => { "value" => "Outright" },
"12" => { "value" => "Other sale" }, "12" => { "value" => "Other sale" },
}.freeze }.freeze
def guidance_partial
"outright_sale_type_definitions" if form.start_date.year >= 2023
end
end end

6
app/models/form/sales/questions/shared_ownership_type.rb

@ -5,7 +5,7 @@ class Form::Sales::Questions::SharedOwnershipType < ::Form::Question
@check_answer_label = "Type of shared ownership sale" @check_answer_label = "Type of shared ownership sale"
@header = "What is the type of shared ownership sale?" @header = "What is the type of shared ownership sale?"
@hint_text = "A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion" @hint_text = "A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion"
@guidance_partial = "shared_ownership_type_definitions" @guidance_partial = guidance_partial
@guidance_position = GuidancePosition::TOP @guidance_position = GuidancePosition::TOP
@type = "radio" @type = "radio"
@answer_options = answer_options @answer_options = answer_options
@ -36,4 +36,8 @@ class Form::Sales::Questions::SharedOwnershipType < ::Form::Question
} }
end end
end end
def guidance_partial
"shared_ownership_type_definitions" if form.start_date.year >= 2023
end
end end

Loading…
Cancel
Save