From 7aa38fa8a12de7656d8152967ed92eda1f702df1 Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Thu, 19 Dec 2024 18:26:35 +0000 Subject: [PATCH] Move pagination links to partial Tidies up the views a little by moving the code to generate pagination controls to a reusable shared partial. This also adds some extra control to hide the pagination links when only one page is displayed, in line with GDS guidelines. --- app/views/case_workers/admin/allocations/new.html.haml | 3 +-- app/views/case_workers/claims/archived.html.haml | 3 +-- app/views/case_workers/claims/index.html.haml | 3 +-- app/views/external_users/claims/archived.html.haml | 4 +--- app/views/external_users/claims/authorised.html.haml | 4 +--- app/views/external_users/claims/index.html.haml | 3 +-- app/views/external_users/claims/outstanding.html.haml | 4 +--- app/views/shared/_pagination.html.haml | 2 ++ app/views/users/index.html.haml | 3 +-- 9 files changed, 10 insertions(+), 19 deletions(-) create mode 100644 app/views/shared/_pagination.html.haml diff --git a/app/views/case_workers/admin/allocations/new.html.haml b/app/views/case_workers/admin/allocations/new.html.haml index db4c8b5dde..60924cb5fa 100644 --- a/app/views/case_workers/admin/allocations/new.html.haml +++ b/app/views/case_workers/admin/allocations/new.html.haml @@ -13,5 +13,4 @@ .js-re-allocation-page = render partial: 're_allocation' - %nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe + = render partial: 'shared/pagination' diff --git a/app/views/case_workers/claims/archived.html.haml b/app/views/case_workers/claims/archived.html.haml index 985264763f..b00e8c887a 100644 --- a/app/views/case_workers/claims/archived.html.haml +++ b/app/views/case_workers/claims/archived.html.haml @@ -5,5 +5,4 @@ = render partial: 'search_form', locals: { archived: true } = render partial: 'claims_list', locals: { claims: @claims } -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe += render partial: 'shared/pagination' diff --git a/app/views/case_workers/claims/index.html.haml b/app/views/case_workers/claims/index.html.haml index 7290eccf5b..9106f97794 100644 --- a/app/views/case_workers/claims/index.html.haml +++ b/app/views/case_workers/claims/index.html.haml @@ -5,5 +5,4 @@ = render partial: 'search_form', locals: { archived: false } = render partial: 'claims_list', locals: { claims: @claims } -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe += render partial: 'shared/pagination' diff --git a/app/views/external_users/claims/archived.html.haml b/app/views/external_users/claims/archived.html.haml index 46f7afeffc..45b826d4a0 100644 --- a/app/views/external_users/claims/archived.html.haml +++ b/app/views/external_users/claims/archived.html.haml @@ -9,6 +9,4 @@ #details = render partial: 'main_claims_list', locals: { claims: @claims } - -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe + = render partial: 'shared/pagination' diff --git a/app/views/external_users/claims/authorised.html.haml b/app/views/external_users/claims/authorised.html.haml index 2603ca5408..4da1e67d51 100644 --- a/app/views/external_users/claims/authorised.html.haml +++ b/app/views/external_users/claims/authorised.html.haml @@ -10,6 +10,4 @@ #details#listanchor = render partial: 'main_claims_list', locals: { claims: @claims } - -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe + = render partial: 'shared/pagination' diff --git a/app/views/external_users/claims/index.html.haml b/app/views/external_users/claims/index.html.haml index 7e72eaa96d..01aae60ced 100644 --- a/app/views/external_users/claims/index.html.haml +++ b/app/views/external_users/claims/index.html.haml @@ -20,5 +20,4 @@ = render partial: 'main_claims_list', locals: { claims: @claims } -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe += render partial: 'shared/pagination' \ No newline at end of file diff --git a/app/views/external_users/claims/outstanding.html.haml b/app/views/external_users/claims/outstanding.html.haml index 55ddec8af7..1ad26a2527 100644 --- a/app/views/external_users/claims/outstanding.html.haml +++ b/app/views/external_users/claims/outstanding.html.haml @@ -10,6 +10,4 @@ #details#listanchor = render partial: 'main_claims_list', locals: { claims: @claims } - -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe + = render partial: 'shared/pagination' diff --git a/app/views/shared/_pagination.html.haml b/app/views/shared/_pagination.html.haml new file mode 100644 index 0000000000..f774844775 --- /dev/null +++ b/app/views/shared/_pagination.html.haml @@ -0,0 +1,2 @@ +%nav.pagination.app-pagintion--inline + = pagy_nav(@pagy).html_safe if @pagy.pages > 1 \ No newline at end of file diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index b6b56f3b0e..e89f2f7ef8 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -29,6 +29,5 @@ = govuk_table_td('data-label': t('.created')) do = user.created_at -%nav.pagination.app-pagintion--inline - = pagy_nav(@pagy).html_safe += render partial: 'shared/pagination'