Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/views/pages/selection/type.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
<% if @page.present? && @page.routing_conditions.any? %>
<% if @selection_type_input.need_to_reduce_options? %>
<%= govuk_notification_banner(title_text: t("banner.default.title")) do |banner| %>
<% banner.with_heading(text: t("selection_type.routing_and_reduce_your_options_combined_warning.heading"), tag: "h3") %>
<% routes = t("selection_type.routes", count: @page.routing_conditions.count) %>
<% banner.with_heading(text: t("selection_type.routing_and_reduce_your_options_combined_warning.heading", routes:), tag: "h3") %>
<p><%= t("selection_type.routing_and_reduce_your_options_combined_warning.body", pages_link_url: form_pages_path(current_form.id)) %></p>
<% end %>
<% elsif @selection_type_input.show_routing_warning? %>
<%= govuk_notification_banner(title_text: t("banner.default.title")) do |banner| %>
<% banner.with_heading(text: t("selection_type.routing_warning")) %>
<% banner.with_heading(text: t("selection_type.routing_warning", count: @page.routing_conditions.count)) %>
<% end %>
<% end %>
<% elsif @selection_type_input.need_to_reduce_options? %>
Expand Down
11 changes: 8 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2308,13 +2308,18 @@ en:
up_to_3000_options: You can have up to 3,000 options.
up_to_30_options: You can have up to 30 options.
selection_type:
routes:
one: route
other: routes
reduce_your_options_warning:
body: You can only have up to 30 options in a list where people can select one or more options. If you make this change, you’ll be able to edit your list on the next page.
heading: If you change this to ‘one or more options’, you’ll need to edit your list
heading: If you change this to ‘One or more options’, you’ll need to edit your list
routing_and_reduce_your_options_combined_warning:
body: You can only have up to 30 options in a list where people can select one or more options. If you make this change, you’ll be able to edit your list on the next page.
heading: If you change this to ‘one or more options’, the route from this question will be deleted and you’ll need to edit the list
routing_warning: If you change this to ‘one or more options’, the route from this question will be deleted
heading: If you change this to ‘One or more options’, this question’s %{routes} will be deleted and you’ll need to edit the list
routing_warning:
one: If you change this to ‘One or more options’, this question’s route will be deleted
other: If you change this to ‘One or more options’, this question’s routes will be deleted
set_email:
new:
body_html: |
Expand Down
20 changes: 18 additions & 2 deletions spec/views/pages/selection/type.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@

context "when show_routing_warning returns true" do
it "displays a warning about routes being deleted" do
expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_warning"))
expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_warning", count: 1))
end

context "with more than one route from options" do
let(:routing_conditions) { build_list(:condition, 3) }

it "displays a warning about routes being deleted" do
expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_warning", count: 3))
end
end
end

Expand All @@ -111,7 +119,15 @@
end

it "displays a combined warning about routes being deleted and needing to reduce the options" do
expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_and_reduce_your_options_combined_warning.heading"))
expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_and_reduce_your_options_combined_warning.heading", routes: "route"))
end

context "with more than one route from options" do
let(:routing_conditions) { build_list(:condition, 3) }

it "displays a combined warning about routes being deleted and needing to reduce the options" do
expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_and_reduce_your_options_combined_warning.heading", routes: "routes"))
end
end
end
end
Expand Down
Loading