Skip to content

Commit c87952b

Browse files
committed
Pass form to routing page input
Passes the current form to the Pages::RoutingPageInput so that the validation error analytics tracking ahs access to the form name.
1 parent eab12f8 commit c87952b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

app/controllers/pages/conditions_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ class Pages::ConditionsController < PagesController
22
before_action :can_add_page_routing, only: %i[new create]
33

44
def routing_page
5-
routing_page_input = Pages::RoutingPageInput.new({ routing_page_id: params[:routing_page_id] })
5+
routing_page_input = Pages::RoutingPageInput.new({ routing_page_id: params[:routing_page_id], form: current_form })
66
render template: "pages/conditions/routing_page", locals: { form: current_form, routing_page_input: }
77
end
88

99
def set_routing_page
1010
routing_page_id = params[:pages_routing_page_input][:routing_page_id]
11-
routing_page_input = Pages::RoutingPageInput.new({ routing_page_id: })
11+
routing_page_input = Pages::RoutingPageInput.new({ routing_page_id:, form: current_form })
1212

1313
if routing_page_input.valid?
1414
routing_page = PageRepository.find(page_id: routing_page_id, form_id: current_form.id)

app/input_objects/pages/routing_page_input.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Pages::RoutingPageInput < BaseInput
2-
attr_accessor :routing_page_id
2+
attr_accessor :routing_page_id, :form
33

44
validates :routing_page_id, presence: true
55

spec/input_objects/pages/routing_page_input_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require "rails_helper"
22

33
RSpec.describe Pages::RoutingPageInput, type: :model do
4-
let(:routing_page_input) { described_class.new({ routing_page_id: }) }
4+
let(:routing_page_input) { described_class.new({ routing_page_id:, form: }) }
55
let(:form) { create :form, :ready_for_routing }
66
let(:pages) { form.pages }
77
let(:routing_page_id) { pages.first.id }

spec/views/pages/conditions/routing_page.html.erb_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe "pages/conditions/routing_page.html.erb" do
44
let(:form) { create :form, :ready_for_routing }
55
let(:pages) { form.pages }
6-
let(:routing_page_input) { Pages::RoutingPageInput.new }
6+
let(:routing_page_input) { Pages::RoutingPageInput.new(form:) }
77
let(:allowed_to_create_routes) { true }
88
let(:all_routes_created) { false }
99
let(:group) do

0 commit comments

Comments
 (0)