diff --git a/app/views/content_items/guide.html+print.erb b/app/views/content_items/guide.html+print.erb index 2199b021b..25bc17063 100644 --- a/app/views/content_items/guide.html+print.erb +++ b/app/views/content_items/guide.html+print.erb @@ -3,22 +3,54 @@ content_for :simple_header, true content_for :extra_head_content do %> - <% end %>
- <%= render 'govuk_publishing_components/components/title', { title: @content_item.title } %> + <%= render 'govuk_publishing_components/components/title', { + margin_bottom: 6, + title: @content_item.title, + } %> + +
+ <%= render 'govuk_publishing_components/components/lead_paragraph', { + margin_bottom: 6, + text: t("multi_page.printable_version"), + } %> +
+ + <%= render 'govuk_publishing_components/components/print_link', { + data_attributes: { + "track-category": "printButton", + "track-action": "clicked", + "track-label": t("components.print_link.text"), + module: "print-link" + }, + margin_bottom: 8, + text: t("components.print_link.text"), + } %> + <% @content_item.parts.each_with_index do |part, index| %>

<%= "#{index + 1}. #{part['title']}" %>

+ <%= render 'govuk_publishing_components/components/govspeak', - content: part['body'].html_safe, - direction: page_text_direction, - disable_youtube_expansions: true %> + content: part['body'].html_safe, + direction: page_text_direction, + disable_youtube_expansions: true %>
<% end %> + + <%= render 'govuk_publishing_components/components/print_link', { + data_attributes: { + "track-category": "printButton", + "track-action": "clicked", + "track-label": t("components.print_link.text"), + module: "print-link" + }, + text: t("components.print_link.text") + } %>
diff --git a/app/views/content_items/guide.html.erb b/app/views/content_items/guide.html.erb index 84e99e626..2ffd3193e 100644 --- a/app/views/content_items/guide.html.erb +++ b/app/views/content_items/guide.html.erb @@ -61,7 +61,10 @@ <% if @content_item.show_guide_navigation? %> <%= render 'govuk_publishing_components/components/previous_and_next_navigation', @content_item.previous_and_next_navigation %> - <%= render 'govuk_publishing_components/components/print_link', href: @content_item.print_link, text: t("multi_page.print_entire_guide") %> + +
+ <%= t("multi_page.print_entire_guide") %> +
<% end %> <% end %> diff --git a/app/views/content_items/travel_advice.html+print.erb b/app/views/content_items/travel_advice.html+print.erb index 31f0ee353..0e3502bee 100644 --- a/app/views/content_items/travel_advice.html+print.erb +++ b/app/views/content_items/travel_advice.html+print.erb @@ -3,12 +3,32 @@ content_for :simple_header, true content_for :extra_head_content do %> - <% end %>
- <%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %> +
+ <%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %> +
+ +
+ <%= render 'govuk_publishing_components/components/lead_paragraph', { + margin_bottom: 6, + text: t("multi_page.printable_version"), + } %> +
+ + <%= render 'govuk_publishing_components/components/print_link', { + data_attributes: { + "track-category": "printButton", + "track-action": "clicked", + "track-label": t("components.print_link.text"), + module: "print-link" + }, + margin_bottom: 8, + text: t("components.print_link.text"), + } %> + <% @content_item.parts.each_with_index do |part, i| %>

@@ -18,9 +38,19 @@ <%= render 'shared/travel_advice_summary', content_item: @content_item if i == 0 %> <%= render 'govuk_publishing_components/components/govspeak', - content: part['body'].html_safe, - direction: page_text_direction %> + content: part['body'].html_safe, + direction: page_text_direction %>

<% end %> + + <%= render 'govuk_publishing_components/components/print_link', { + data_attributes: { + "track-category": "printButton", + "track-action": "clicked", + "track-label": t("components.print_link.text"), + module: "print-link" + }, + text: t("components.print_link.text") + } %>
diff --git a/app/views/content_items/travel_advice.html.erb b/app/views/content_items/travel_advice.html.erb index ca6efbeb8..bef893e81 100644 --- a/app/views/content_items/travel_advice.html.erb +++ b/app/views/content_items/travel_advice.html.erb @@ -8,7 +8,7 @@ canonical_url: @content_item.canonical_url, title: @content_item.page_title, body: @content_item.current_part_body - ) %> + ) %> <% end %>
@@ -16,14 +16,12 @@ <%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
@@ -53,7 +51,7 @@ <%= render 'govuk_publishing_components/components/previous_and_next_navigation', @content_item.previous_and_next_navigation %>
- <%= render 'govuk_publishing_components/components/print_link', href: @content_item.print_link, text: t("multi_page.print_entire_guide") %> + <%= t("multi_page.print_entire_guide") %>
<%= render 'shared/sidebar_navigation' %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 3b0abf1c7..1e2d6fe27 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -24,6 +24,8 @@ en: show_all: show all share_links: share_this_page: Share this page + print_link: + text: "Print this page" consultation: and: and another_website_html: This consultation %{closed} held on another website @@ -428,7 +430,8 @@ en: multi_page: next_page: Next previous_page: Previous - print_entire_guide: Print entire guide + print_entire_guide: View a printable version of the whole guide + printable_version: Printable version publication: details: Details documents: @@ -471,6 +474,7 @@ en: avoid_all_travel_to_parts_html: The FCDO advise against all travel to parts of the country. avoid_all_travel_to_whole_country_html: The FCDO advise against all travel to the whole country. context: Foreign travel advice + pages: Travel advice pages still_current_at: Still current at summary: Summary updated: Updated diff --git a/test/integration/guide_test.rb b/test/integration/guide_test.rb index 86f11d96b..4010f3f0b 100644 --- a/test/integration/guide_test.rb +++ b/test/integration/guide_test.rb @@ -13,7 +13,7 @@ class GuideTest < ActionDispatch::IntegrationTest assert page.has_css?("h1", text: @content_item["details"]["parts"].first["title"]) assert page.has_css?(".gem-c-pagination") - assert page.has_css?('.gem-c-print-link a[href$="/print"]') + assert page.has_css?(".govuk-link.govuk-link--no-visited-state[href$='/print']", text: "View a printable version of the whole guide") end test "draft access tokens are appended to part links within navigation" do @@ -60,14 +60,14 @@ class GuideTest < ActionDispatch::IntegrationTest setup_and_visit_content_item("guide-with-step-navs-and-hide-navigation") assert_not page.has_css?(".gem-c-pagination") - assert_not page.has_css?(".gem-c-print-link") + assert_not page.has_css?(".govuk-link.govuk-link--no-visited-state[href$='/print']") end test "shows guide navigation and print link if not in a step by step and hide_chapter_navigation is true" do setup_and_visit_content_item("guide-with-hide-navigation") assert page.has_css?(".gem-c-pagination") - assert page.has_css?(".gem-c-print-link") + assert page.has_css?(".govuk-link.govuk-link--no-visited-state[href$='/print']", text: "View a printable version of the whole guide") end test "guides with no parts in a step by step with hide_chapter_navigation do not error" do diff --git a/test/integration/travel_advice_test.rb b/test/integration/travel_advice_test.rb index cb0011417..079142960 100644 --- a/test/integration/travel_advice_test.rb +++ b/test/integration/travel_advice_test.rb @@ -14,16 +14,16 @@ class TravelAdviceTest < ActionDispatch::IntegrationTest assert page.has_css?("a[href=\"#{@content_item['details']['email_signup_link']}\"]", text: "Get email alerts") assert page.has_css?("a[href=\"#{@content_item['base_path']}.atom\"]", text: "Subscribe to feed") - assert page.has_css?(".part-navigation li", count: @content_item["details"]["parts"].size + 1) - assert page.has_css?(".part-navigation li", text: "Summary") + assert page.has_css?(".part-navigation-container nav li", count: @content_item["details"]["parts"].size + 1) + assert page.has_css?(".part-navigation-container nav li", text: "Summary") assert_not page.has_css?(".part-navigation li a", text: "Summary") @content_item["details"]["parts"].each do |part| - assert page.has_css?(".part-navigation li a[href*=\"#{part['slug']}\"]", text: part["title"]) + assert page.has_css?(".part-navigation-container nav li a[href*=\"#{part['slug']}\"]", text: part["title"]) end assert page.has_css?(".gem-c-pagination") - assert page.has_css?('.gem-c-print-link a[href$="/print"]') + assert page.has_css?('.govuk-link.govuk-link--no-visited-state[href$="/print"]', text: "View a printable version of the whole guide") end test "travel advice summary has latest updates and map" do @@ -55,8 +55,8 @@ class TravelAdviceTest < ActionDispatch::IntegrationTest assert_not page.has_css?(".map") assert_not page.has_css?(".gem-c-metadata") - assert page.has_css?(".part-navigation li", text: first_part["title"]) - assert_not page.has_css?(".part-navigation li a", text: first_part["title"]) + assert page.has_css?(".part-navigation-container nav li", text: first_part["title"]) + assert_not page.has_css?(".part-navigation-container nav li a", text: first_part["title"]) end test "travel advice includes a discoverable atom feed link" do