diff --git a/app/controllers/travel_advice_controller.rb b/app/controllers/travel_advice_controller.rb index 92a7fdc760..2bc9a762ac 100644 --- a/app/controllers/travel_advice_controller.rb +++ b/app/controllers/travel_advice_controller.rb @@ -20,6 +20,8 @@ def index def show @content_item.set_current_part(params[:slug]) + request.variant = :print if params[:variant] == "print" + respond_to do |format| format.html format.atom diff --git a/app/views/travel_advice/show.html+print.erb b/app/views/travel_advice/show.html+print.erb new file mode 100644 index 0000000000..b3d484f9a7 --- /dev/null +++ b/app/views/travel_advice/show.html+print.erb @@ -0,0 +1,45 @@ +<% add_view_stylesheet("travel-advice") %> +<% + content_for :title, "Print #{@content_item.page_title}" + 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/lead_paragraph', { + margin_bottom: 6, + text: t("multi_page.printable_version"), + } %> +
+ + <%= render 'govuk_publishing_components/components/print_link', { + margin_bottom: 8, + text: t("components.print_link.text"), + } %> + + <% @content_item.parts.each_with_index do |part, i| %> +
+

+ <%= part['title'] %> +

+ + <%= render 'shared/travel_advice_first_part', content_item: @content_item if i == 0 %> + + <%= render 'govuk_publishing_components/components/govspeak', + content: part['body'].html_safe, + direction: page_text_direction %> +
+ <% end %> + + <%= render 'govuk_publishing_components/components/print_link', { + text: t("components.print_link.text") + } %> +
+
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 140addc2a6..55007054c4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,7 +25,11 @@ get "/find-local-council/:authority_slug" => "find_local_council#result" get "/foreign-travel-advice", to: "travel_advice#index", as: :travel_advice - get "/foreign-travel-advice/:country/*slug", to: "travel_advice#show" + get "/foreign-travel-advice/:country/*slug/:variant", + to: "travel_advice#show", + constraints: { + variant: /print/, + } # Accounts get "/sign-in", to: "help#sign_in"