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
3 changes: 1 addition & 2 deletions app/controllers/pages/routes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
class Pages::RoutesController < PagesController
def show
back_link_url = form_pages_path(current_form.id)
route_summary_card_data_presenter = RouteSummaryCardDataPresenter.new(form: current_form, page:)

render locals: { current_form:, page:, back_link_url:, route_summary_card_data_presenter: }
render locals: { current_form:, page:, route_summary_card_data_presenter: }
end

def delete
Expand Down
2 changes: 1 addition & 1 deletion app/views/pages/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<% end %>
<% end %>
<li>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(form_object.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(form_object.id) %>
</li>
</ul>
<% end %>
2 changes: 1 addition & 1 deletion app/views/pages/address_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/change_order.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% set_page_title(title_with_error_prefix(t("page_titles.change_page_order"), @change_order_input.errors.any?)) %>
<% content_for :back_link, govuk_back_link_to(form_pages_path(@change_order_input.form.id), t("pages.change_order.back_link")) %>
<% content_for :back_link, govuk_back_link_to(form_pages_path(@change_order_input.form.id), t("back_link.form_pages")) %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/pages/conditions/routing_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/date_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</li>
<% end %>
<li>
<%= govuk_link_to t("pages.go_to_your_questions"), form_pages_path(current_form.id) %>
<%= govuk_link_to t("pages.back_to_your_questions"), form_pages_path(current_form.id) %>
</li>
</ul>
<% end%>
Expand Down
2 changes: 1 addition & 1 deletion app/views/pages/guidance.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<% end %>
<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/name_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/question_text.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
4 changes: 2 additions & 2 deletions app/views/pages/routes/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% set_page_title(title_with_error_prefix(t('page_titles.routes_show', question_number: page.position), false)) %>
<% content_for :back_link, govuk_back_link_to(back_link_url, t('pages.go_to_your_questions')) %>
<% content_for :back_link, govuk_back_link_to(form_pages_path(current_form.id), t('back_link.form_pages')) %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down Expand Up @@ -42,6 +42,6 @@
<% end %>

<p class="govuk-body">
<%= govuk_link_to t("pages.go_to_your_questions"), form_pages_path(current_form.id) %>
<%= govuk_link_to t("pages.back_to_your_questions"), form_pages_path(current_form.id) %>
</p>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/selection/bulk_options.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/selection/none_of_the_above.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/selection/options.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/selection/type.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/text_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/pages/type_of_answer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<% end %>

<p>
<%= govuk_link_to t('pages.go_to_your_questions'), form_pages_path(current_form.id) %>
<%= govuk_link_to t('pages.back_to_your_questions'), form_pages_path(current_form.id) %>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/routes/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% set_page_title(t("page_titles.routes")) %>
<% content_for :back_link, govuk_back_link_to(form_pages_path(@current_form.id), t("back_link.form_view")) %>
<% content_for :back_link, govuk_back_link_to(form_pages_path(@current_form.id), t("back_link.form_pages")) %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
4 changes: 2 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ en:
back_link:
form_create: Back to create your form
form_edit: Back to edit your form
form_pages: Back to your questions
form_view: Back to your form
forms: Back to your forms
group: Back to %{group_name}
Expand Down Expand Up @@ -1606,8 +1607,8 @@ en:
your_welsh_form_is_live: Your Welsh form is live
pages:
answer_settings: Answer settings
back_to_your_questions: Back to your questions
change_order:
back_link: Back to Add and edit your questions
move_question_to_label: Move question %{position} to (optional)
preview_banner: You need to save this question order if you want to keep these changes
preview_button: Preview new question order
Expand Down Expand Up @@ -1674,7 +1675,6 @@ en:
edit:
back_link: Back to edit route 1
delete_exit_page: Delete exit page
go_to_your_questions: Back to your questions
heading: Edit question
index:
add_a_question_route: Add a question route
Expand Down
14 changes: 7 additions & 7 deletions spec/views/pages/routes/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@

context "when there are no routes" do
before do
render template: "pages/routes/show", locals: { current_form: form, page:, back_link_url: "/back", route_summary_card_data_presenter: route_summary_card_data_service }
render template: "pages/routes/show", locals: { current_form: form, page:, route_summary_card_data_presenter: route_summary_card_data_service }
end

it "has the correct title" do
expect(view.content_for(:title)).to have_content("Question 1’s routes")
end

it "has the correct back link" do
expect(view.content_for(:back_link)).to have_link(I18n.t("pages.go_to_your_questions"), href: "/back")
expect(view.content_for(:back_link)).to have_link(I18n.t("back_link.form_pages"), href: form_pages_path(form.id))
end

it "has the correct heading and caption" do
Expand All @@ -53,7 +53,7 @@
end

it "has a back to questions link" do
expect(rendered).to have_link(I18n.t("pages.go_to_your_questions"), href: form_pages_path(form.id))
expect(rendered).to have_link(I18n.t("pages.back_to_your_questions"), href: form_pages_path(form.id))
end

it "does not have a link to delete all routes" do
Expand All @@ -68,7 +68,7 @@
create :condition, routing_page_id: pages.first.id, check_page_id: pages.first.id, answer_value: "Option 1", goto_page_id: pages.third.id
pages.each(&:reload)

render template: "pages/routes/show", locals: { current_form: form, page:, back_link_url: "/back", route_summary_card_data_presenter: route_summary_card_data_service }
render template: "pages/routes/show", locals: { current_form: form, page:, route_summary_card_data_presenter: route_summary_card_data_service }
end

it "does not have a link to delete all routes" do
Expand Down Expand Up @@ -120,7 +120,7 @@
create :condition, :with_exit_page, routing_page_id: page.id, check_page_id: page.id, answer_value: "Option 1"
pages.each(&:reload)

render template: "pages/routes/show", locals: { current_form: form, page:, back_link_url: "/back", route_summary_card_data_presenter: route_summary_card_data_service }
render template: "pages/routes/show", locals: { current_form: form, page:, route_summary_card_data_presenter: route_summary_card_data_service }
end

it "does not show the link to set questions to skip" do
Expand All @@ -140,7 +140,7 @@
create :condition, routing_page_id: pages.second.id, check_page_id: pages.first.id, goto_page_id: pages.fourth.id
pages.each(&:reload)

render template: "pages/routes/show", locals: { current_form: form, page:, back_link_url: "/back", route_summary_card_data_presenter: route_summary_card_data_service }
render template: "pages/routes/show", locals: { current_form: form, page:, route_summary_card_data_presenter: route_summary_card_data_service }
end

it "has a link to delete all routes" do
Expand All @@ -157,7 +157,7 @@
let(:errors) { [OpenStruct.new(link: "goto-1", message: "Error text")] }

before do
render template: "pages/routes/show", locals: { current_form: form, page:, back_link_url: "/back", route_summary_card_data_presenter: route_summary_card_data_service }
render template: "pages/routes/show", locals: { current_form: form, page:, route_summary_card_data_presenter: route_summary_card_data_service }
end

it "shows the error message" do
Expand Down
2 changes: 1 addition & 1 deletion spec/views/routes/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def render_page

it "has the correct back link" do
render_page
expect(view.content_for(:back_link)).to have_link("Back to your form", href: form_pages_path(form.id))
expect(view.content_for(:back_link)).to have_link("Back to your questions", href: form_pages_path(form.id))
end

it "has the correct heading and caption" do
Expand Down