Skip to content

Commit

Permalink
Refactor radio buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
neb417 committed Nov 5, 2024
1 parent 3c0440d commit 3747a3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/concerns/taxed_income.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def hourly_income

def federal_tax_table_type_id
filter = params[:federal_tax_table_type_id].present? ? { id: params[:federal_tax_table_type_id] } : { filing_status: "single" }
FederalTaxTableType.find_by(filter).id
@federal_tax_table_type_id = FederalTaxTableType.find_by(filter).id
end

def build_income_tax_object(income:)
Expand Down
2 changes: 1 addition & 1 deletion app/views/dashboard/_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<div class="flex flex-row">
<% FederalTaxTableType.all.each do |table| %>
<div class="mx-auto">
<%= form.radio_button :federal_tax_table_type_id, table.id, checked: table.filing_status == 'single', onchange: "this.form.requestSubmit()" %>
<%= form.radio_button :federal_tax_table_type_id, table.id, checked: table.id == @federal_tax_table_type_id, onchange: "this.form.requestSubmit()" %>
<%= form.label :federal_tax_table_type_id, table.filing_status.humanize.capitalize %>
</div>
<% end %>
Expand Down

0 comments on commit 3747a3e

Please sign in to comment.