Skip to content

Commit

Permalink
Rename location field partial
Browse files Browse the repository at this point in the history
  • Loading branch information
sarvaiyanidhi committed Dec 16, 2024
1 parent d85548d commit 2ac5309
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion app/views/organization_account_requests/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

<div class="col-lg-6">
<div class="input-group">
<%= render 'shared/country_province_state_city', form: form %>
<%= render 'shared/location_fields', form: form %>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!-- Nested Form for Locations Table -->
<div class="form-group bigger" data-controller="country-state">
<%= person_form.fields_for :location, user.person.location do |location_form| %>
<%= render 'shared/country_province_state_city', form: location_form %>
<%= render 'shared/location_fields', form: location_form %>
<% end %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/organizations/staff/fosterers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<!-- Nested Form for Locations Table -->
<div class="form-group bigger" data-controller="country-state">
<%= f.fields_for :location, fosterer.location do |location_form| %>
<%= render 'shared/country_province_state_city', form: location_form %>
<%= render 'shared/location_fields', form: location_form %>
<% end %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/organizations/staff/organizations/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<div class="form-group bigger" data-controller="country-state">
<% location = organization.locations.last || organization.locations.build %>
<%= form.fields_for :locations, location do |location_form| %>
<%= render 'shared/country_province_state_city', form: location_form %>
<%= render 'shared/location_fields', form: location_form %>
<% end %>
</div>
</div>
Expand Down
25 changes: 0 additions & 25 deletions app/views/shared/_country_province_state_city.erb

This file was deleted.

25 changes: 25 additions & 0 deletions app/views/shared/_location_fields.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- Country Select -->
<%= form.select :country,
CS.keys.index_with { |abbr| CS.dig(abbr, :name) }.invert,
{ prompt: "Please select" },
{
'data-path': country_states_path,
'data-country-state-target': 'country',
'data-action': 'change->country-state#updateStates',
required: true,
class: 'form-control'
} %>
<!-- Province/State Select -->
<%= form.select :province_state,
form.object.country.present? ?
CS.dig(form.object.country.to_sym, :states)&.map { |abbr, name| [:name, abbr] } : [],
{ prompt: "Please select" },
{
'data-country-state-target': 'state',
required: true,
class: 'form-control'
} %>
<!-- City/Town Text Field -->
<%= form.text_field :city_town,
required: false,
class: "form-control" %>

0 comments on commit 2ac5309

Please sign in to comment.