Skip to content

Commit

Permalink
[rubyforgood#5777] Remove excess behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
priyapower committed Jul 17, 2024
1 parent 5160d38 commit 8b76177
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/components/form/step_navigation_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<%# 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'}",
Expand All @@ -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'}",
Expand Down
4 changes: 1 addition & 3 deletions app/components/form/step_navigation_component.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion app/views/case_contacts/form/details.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<%= 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 %>

<div class="card-style-1 pl-25 mb-10">
Expand Down
2 changes: 1 addition & 1 deletion app/views/case_contacts/form/expenses.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<div>
<%= 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 %>

<div class="card-style-1 pl-25 mb-10 pr-50">
Expand Down
2 changes: 1 addition & 1 deletion app/views/case_contacts/form/notes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div>
<%= 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: %>
<div class="card-style-1 pl-25 pr-25 mb-10">
<div class="d-flex justify-content-between mb-3"
Expand Down

0 comments on commit 8b76177

Please sign in to comment.