From 8b76177b83862345c4272d1c50f94ddaad6e92c0 Mon Sep 17 00:00:00 2001 From: Priya Power <49959312+priyapower@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:54:51 -0500 Subject: [PATCH] [#5777] Remove excess behavior --- app/components/form/step_navigation_component.html.erb | 4 ++-- app/components/form/step_navigation_component.rb | 4 +--- app/views/case_contacts/form/details.html.erb | 2 +- app/views/case_contacts/form/expenses.html.erb | 2 +- app/views/case_contacts/form/notes.html.erb | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/components/form/step_navigation_component.html.erb b/app/components/form/step_navigation_component.html.erb index 163e7caad6..d27d150f79 100644 --- a/app/components/form/step_navigation_component.html.erb +++ b/app/components/form/step_navigation_component.html.erb @@ -1,6 +1,6 @@
<%# Back navigation %> - <%= button_tag type: @submit_back ? :submit : :button, + <%= button_tag type: :submit, name: :nav_step, value: @nav_back, class: "btn btn-link #{@nav_back.nil? ? 'disabled' : 'enabled'}", @@ -13,7 +13,7 @@ <% end %> <%# Next navigation %> - <%= button_tag type: @submit_next ? :submit : :button, + <%= button_tag type: :submit, name: :nav_step, value: @nav_forward, class: "btn btn-link #{@nav_next.nil? ? 'disabled' : 'enabled'}", diff --git a/app/components/form/step_navigation_component.rb b/app/components/form/step_navigation_component.rb index 4ed3c17201..1adf102f15 100644 --- a/app/components/form/step_navigation_component.rb +++ b/app/components/form/step_navigation_component.rb @@ -1,10 +1,8 @@ # frozen_string_literal: true class Form::StepNavigationComponent < ViewComponent::Base - def initialize(nav_back: nil, nav_next: nil, submit_back: false, submit_next: false) + def initialize(nav_back: nil, nav_next: nil) @nav_back = nav_back @nav_next = nav_next - @submit_back = submit_back - @submit_next = submit_next end end diff --git a/app/views/case_contacts/form/details.html.erb b/app/views/case_contacts/form/details.html.erb index 8c39b8d403..d810aa1f53 100644 --- a/app/views/case_contacts/form/details.html.erb +++ b/app/views/case_contacts/form/details.html.erb @@ -1,6 +1,6 @@
<%= form_with(model: @case_contact, url: wizard_path(nil, case_contact_id: @case_contact.id), local: true, id: "casa-contact-form", class: "component-validated-form") do |form| %> - <%= render(Form::TitleComponent.new(title: @case_contact.decorate.form_title, subtitle: "Contact details", step: @page, total_steps: @total_pages, navigable: Form::StepNavigationComponent.new(nav_back: leave_case_contacts_form_path, nav_next: next_wizard_path, submit_back: false, submit_next: true))) %> + <%= render(Form::TitleComponent.new(title: @case_contact.decorate.form_title, subtitle: "Contact details", step: @page, total_steps: @total_pages, navigable: Form::StepNavigationComponent.new(nav_back: leave_case_contacts_form_path, nav_next: next_wizard_path))) %> <%= render "/shared/error_messages", resource: @case_contact %>
diff --git a/app/views/case_contacts/form/expenses.html.erb b/app/views/case_contacts/form/expenses.html.erb index 56b4281922..9bfac9209c 100644 --- a/app/views/case_contacts/form/expenses.html.erb +++ b/app/views/case_contacts/form/expenses.html.erb @@ -1,7 +1,7 @@
<%= form_with(model: @case_contact, url: wizard_path(nil, case_contact_id: @case_contact.id), local: true, id: "casa-contact-form", class: "component-validated-form") do |form| %> - <%= render(Form::TitleComponent.new(title: @case_contact.decorate.form_title, subtitle: "Contact expenses", step: @page, total_steps: @total_pages, navigable: Form::StepNavigationComponent.new(nav_back: previous_wizard_path, nav_next: nil, submit_back: true, submit_next: true))) %> + <%= render(Form::TitleComponent.new(title: @case_contact.decorate.form_title, subtitle: "Contact expenses", step: @page, total_steps: @total_pages, navigable: Form::StepNavigationComponent.new(nav_back: previous_wizard_path, nav_next: nil))) %> <%= render "/shared/error_messages", resource: @case_contact %>
diff --git a/app/views/case_contacts/form/notes.html.erb b/app/views/case_contacts/form/notes.html.erb index 833cecf3b0..12f8d404d3 100644 --- a/app/views/case_contacts/form/notes.html.erb +++ b/app/views/case_contacts/form/notes.html.erb @@ -2,7 +2,7 @@
<%= form_with(model: @case_contact, url: wizard_path(nil, case_contact_id: @case_contact.id), id: "casa-contact-form", class: "component-validated-form", data: { "turbo-action": "advance", "autosave-target": "form" }) do |form| %> - <%= render(Form::TitleComponent.new(title: @case_contact.decorate.form_title, subtitle: "Contact notes", step: @page, total_steps: @total_pages, notes: @case_contact.decorate.form_page_notes[:notes], autosave: true, navigable: Form::StepNavigationComponent.new(nav_back: previous_wizard_path, nav_next: @case_contact.casa_org_any_expenses_enabled? ? next_wizard_path : nil, submit_back: true, submit_next: true))) %> + <%= render(Form::TitleComponent.new(title: @case_contact.decorate.form_title, subtitle: "Contact notes", step: @page, total_steps: @total_pages, notes: @case_contact.decorate.form_page_notes[:notes], autosave: true, navigable: Form::StepNavigationComponent.new(nav_back: previous_wizard_path, nav_next: @case_contact.casa_org_any_expenses_enabled? ? next_wizard_path : nil))) %> <%= render "contact_topic_notes", form: %>