Browse Source

Extract common questions

pull/873/head
baarkerlounger 3 years ago
parent
commit
d7d78e0da8
  1. 4
      app/models/form/common/pages/created_by.rb
  2. 4
      app/models/form/common/pages/organisation.rb
  3. 2
      app/models/form/common/questions/created_by_id.rb
  4. 2
      app/models/form/common/questions/owning_organisation_id.rb
  5. 4
      app/models/form/lettings/subsections/setup.rb
  6. 4
      app/models/form/sales/pages/purchaser_code.rb
  7. 2
      app/models/form/sales/questions/purchaser_code.rb
  8. 4
      app/models/form/sales/subsections/setup.rb
  9. 2
      spec/models/form/common/pages/created_by_spec.rb
  10. 2
      spec/models/form/common/pages/organisation_spec.rb
  11. 2
      spec/models/form/common/questions/created_by_id_spec.rb
  12. 2
      spec/models/form/common/questions/owning_organisation_id_spec.rb
  13. 2
      spec/models/form/sales/pages/purchaser_code_spec.rb
  14. 2
      spec/models/form/sales/questions/purchaser_code_spec.rb

4
app/models/form/lettings/pages/created_by.rb → app/models/form/common/pages/created_by.rb

@ -1,4 +1,4 @@
class Form::Lettings::Pages::CreatedBy < ::Form::Page
class Form::Common::Pages::CreatedBy < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "created_by"
@ -9,7 +9,7 @@ class Form::Lettings::Pages::CreatedBy < ::Form::Page
def questions
@questions ||= [
Form::Lettings::Questions::CreatedById.new(nil, nil, self),
Form::Common::Questions::CreatedById.new(nil, nil, self),
]
end

4
app/models/form/lettings/pages/organisation.rb → app/models/form/common/pages/organisation.rb

@ -1,4 +1,4 @@
class Form::Lettings::Pages::Organisation < ::Form::Page
class Form::Common::Pages::Organisation < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "organisation"
@ -9,7 +9,7 @@ class Form::Lettings::Pages::Organisation < ::Form::Page
def questions
@questions ||= [
Form::Lettings::Questions::OwningOrganisationId.new(nil, nil, self),
Form::Common::Questions::OwningOrganisationId.new(nil, nil, self),
]
end

2
app/models/form/lettings/questions/created_by_id.rb → app/models/form/common/questions/created_by_id.rb

@ -1,4 +1,4 @@
class Form::Lettings::Questions::CreatedById < ::Form::Question
class Form::Common::Questions::CreatedById < ::Form::Question
def initialize(id, hsh, page)
super
@id = "created_by_id"

2
app/models/form/lettings/questions/owning_organisation_id.rb → app/models/form/common/questions/owning_organisation_id.rb

@ -1,4 +1,4 @@
class Form::Lettings::Questions::OwningOrganisationId < ::Form::Question
class Form::Common::Questions::OwningOrganisationId < ::Form::Question
def initialize(id, hsh, page)
super
@id = "owning_organisation_id"

4
app/models/form/lettings/subsections/setup.rb

@ -8,8 +8,8 @@ class Form::Lettings::Subsections::Setup < ::Form::Subsection
def pages
@pages ||= [
Form::Lettings::Pages::Organisation.new(nil, nil, self),
Form::Lettings::Pages::CreatedBy.new(nil, nil, self),
Form::Common::Pages::Organisation.new(nil, nil, self),
Form::Common::Pages::CreatedBy.new(nil, nil, self),
Form::Lettings::Pages::NeedsType.new(nil, nil, self),
Form::Lettings::Pages::Scheme.new(nil, nil, self),
Form::Lettings::Pages::Location.new(nil, nil, self),

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

@ -1,4 +1,4 @@
class Form::Sales::Setup::Pages::PurchaserCode < ::Form::Page
class Form::Sales::Pages::PurchaserCode < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "purchaser_code"
@ -9,7 +9,7 @@ class Form::Sales::Setup::Pages::PurchaserCode < ::Form::Page
def questions
@questions ||= [
Form::Sales::Setup::Questions::PurchaserCode.new(nil, nil, self),
Form::Sales::Questions::PurchaserCode.new(nil, nil, self),
]
end
end

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

@ -1,4 +1,4 @@
class Form::Sales::Setup::Questions::PurchaserCode < ::Form::Question
class Form::Sales::Questions::PurchaserCode < ::Form::Question
def initialize(id, hsh, page)
super
@id = "purchid"

4
app/models/form/sales/subsections/setup.rb

@ -8,8 +8,8 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection
def pages
@pages ||= [
Form::Sales::Setup::Pages::PurchaserCode.new(nil, nil, self),
Form::Sales::Setup::Pages::SaleDate.new(nil, nil, self),
Form::Sales::Pages::PurchaserCode.new(nil, nil, self),
Form::Sales::Pages::SaleDate.new(nil, nil, self),
]
end
end

2
spec/models/form/lettings/pages/created_by_spec.rb → spec/models/form/common/pages/created_by_spec.rb

@ -1,6 +1,6 @@
require "rails_helper"
RSpec.describe Form::Lettings::Pages::CreatedBy, type: :model do
RSpec.describe Form::Common::Pages::CreatedBy, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }

2
spec/models/form/lettings/pages/organisation_spec.rb → spec/models/form/common/pages/organisation_spec.rb

@ -1,6 +1,6 @@
require "rails_helper"
RSpec.describe Form::Lettings::Pages::Organisation, type: :model do
RSpec.describe Form::Common::Pages::Organisation, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }

2
spec/models/form/lettings/questions/created_by_id_spec.rb → spec/models/form/common/questions/created_by_id_spec.rb

@ -1,6 +1,6 @@
require "rails_helper"
RSpec.describe Form::Lettings::Questions::CreatedById, type: :model do
RSpec.describe Form::Common::Questions::CreatedById, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }

2
spec/models/form/lettings/questions/owning_organisation_id_spec.rb → spec/models/form/common/questions/owning_organisation_id_spec.rb

@ -1,6 +1,6 @@
require "rails_helper"
RSpec.describe Form::Lettings::Questions::OwningOrganisationId, type: :model do
RSpec.describe Form::Common::Questions::OwningOrganisationId, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }

2
spec/models/form/sales/pages/purchaser_code_spec.rb

@ -1,6 +1,6 @@
require "rails_helper"
RSpec.describe Form::Sales::Setup::Pages::PurchaserCode, type: :model do
RSpec.describe Form::Sales::Pages::PurchaserCode, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }

2
spec/models/form/sales/questions/purchaser_code_spec.rb

@ -1,6 +1,6 @@
require "rails_helper"
RSpec.describe Form::Sales::Setup::Questions::PurchaserCode, type: :model do
RSpec.describe Form::Sales::Questions::PurchaserCode, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }

Loading…
Cancel
Save