Skip to content

Commit

Permalink
Hide additional fields for countries with one region
Browse files Browse the repository at this point in the history
At the moment with countryies with on region there are two places you
can put this information, which is confusing. Instead we should hide it
to encourage users to use the region.
  • Loading branch information
thomasleese committed Sep 8, 2023
1 parent 3f0b14c commit 99ed197
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/views/support_interface/countries/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
<%= f.govuk_radio_button :has_regions, :false, label: { text: "No" } %>
<% end %>

<%= render "shared/support_interface/country_region_information_fields", f: %>
<% if @country.regions.count > 1 %>
<%= render "shared/support_interface/country_region_information_fields", f: %>
<% end %>

<%= f.govuk_submit "Preview", name: "preview", value: "true" do %>
<%= f.govuk_submit "Save", name: "preview", value: "false", secondary: true %>
Expand Down
4 changes: 3 additions & 1 deletion spec/system/support_interface/countries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
def given_countries_exist
create(:region, :national, country: create(:country, code: "IE"))
create(:region, :national, country: create(:country, code: "PL"))
create(:region, name: "Hawaii", country: create(:country, code: "US"))
united_states = create(:country, code: "US")
create(:region, name: "Hawaii", country: united_states)
create(:region, name: "New York", country: united_states)
create(:region, :national, country: create(:country, code: "ES"))
create(
:region,
Expand Down

0 comments on commit 99ed197

Please sign in to comment.