From d519c7f160f9acc48fade7f1a65faad313de5005 Mon Sep 17 00:00:00 2001 From: Katherine Martin <78093815+martikat@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:10:50 +0100 Subject: [PATCH] Update print this page logic --- app/views/pages/default.html.slim | 8 ++------ app/views/pages/side_nav.slim | 8 ++------ app/views/shared/_print.html.slim | 3 +++ 3 files changed, 7 insertions(+), 12 deletions(-) create mode 100644 app/views/shared/_print.html.slim diff --git a/app/views/pages/default.html.slim b/app/views/pages/default.html.slim index 7a20cc39..ec68bddf 100644 --- a/app/views/pages/default.html.slim +++ b/app/views/pages/default.html.slim @@ -15,9 +15,7 @@ | Contents on this page = m(page.content_list) - div class='gem-c-print-link print-button govuk-!-margin-top-7' - button.govuk-link.print-link-button class="govuk-link gem-c-print-link__button" onclick="window.print()" data-module="print-link" - | Print this page + = render 'shared/print' .govuk-grid-row class='govuk-!-margin-top-4 govuk-!-margin-bottom-5' .govuk-grid-column-full @@ -35,8 +33,6 @@ dd.gem-c-metadata__definition data-module="ga4-link-tracker" data-ga4-track-links-only="" data-ga4-link="{"event_name":"navigation","type":"content history","section":"Top","action":"opened"}" data-ga4-link-tracker-module-started="true" #{page.updated_at.to_s(:long)} - if page.content_list.present? - div class='gem-c-print-link print-button govuk-!-margin-top-7' - button.govuk-link.print-link-button class='govuk-link gem-c-print-link__button' onclick='window.print()' data-module='print-link' - | Print this page + = render 'shared/print' = render 'shared/ctas' diff --git a/app/views/pages/side_nav.slim b/app/views/pages/side_nav.slim index 118e2c37..c92d0833 100644 --- a/app/views/pages/side_nav.slim +++ b/app/views/pages/side_nav.slim @@ -29,15 +29,11 @@ | Contents on this page = m(page.content_list) - div class='gem-c-print-link print-button govuk-!-margin-top-7' - button.govuk-link.print-link-button class='govuk-link gem-c-print-link__button' onclick='window.print()' data-module='print-link' - | Print this page + = render 'shared/print' = m(page.body) - if page.content_list.present? - div class='gem-c-print-link print-button govuk-!-margin-top-7' - button.govuk-link.print-link-button class='govuk-link gem-c-print-link__button' onclick='window.print()' data-module='print-link' - | Print this page + = render 'shared/print' = render 'shared/ctas' diff --git a/app/views/shared/_print.html.slim b/app/views/shared/_print.html.slim new file mode 100644 index 00000000..372d93a6 --- /dev/null +++ b/app/views/shared/_print.html.slim @@ -0,0 +1,3 @@ +div class='govuk-!-margin-top-7' + button.govuk-link.print-link-button onclick='window.print()' data-module='print-link' + | Print this page